@InterfaceAudience.Private public class HDFSBlocksDistribution extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HDFSBlocksDistribution.HostAndWeight
Stores the hostname and weight for that hostname.
|
Constructor and Description |
---|
HDFSBlocksDistribution()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(HDFSBlocksDistribution otherBlocksDistribution)
This will add the distribution from input to this object
|
void |
addHostsAndBlockWeight(String[] hosts,
long weight)
add some weight to a list of hosts, update the value of unique block weight
|
float |
getBlockLocalityIndex(String host)
return the locality index of a given host
|
Map<String,HDFSBlocksDistribution.HostAndWeight> |
getHostAndWeights() |
List<String> |
getTopHosts()
return the sorted list of hosts in terms of their weights
|
HDFSBlocksDistribution.HostAndWeight[] |
getTopHostsWithWeights()
return the sorted list of hosts in terms of their weights
|
long |
getUniqueBlocksTotalWeight() |
long |
getWeight(String host)
return the weight for a specific host, that will be the total bytes of all
blocks on the host
|
String |
toString() |
public String toString()
toString
in class Object
Object.toString()
public void addHostsAndBlockWeight(String[] hosts, long weight)
hosts
- the list of the hostweight
- the weightpublic Map<String,HDFSBlocksDistribution.HostAndWeight> getHostAndWeights()
public long getWeight(String host)
host
- the host namepublic long getUniqueBlocksTotalWeight()
public float getBlockLocalityIndex(String host)
host
- the host namepublic void add(HDFSBlocksDistribution otherBlocksDistribution)
otherBlocksDistribution
- the other hdfs blocks distributionpublic List<String> getTopHosts()
public HDFSBlocksDistribution.HostAndWeight[] getTopHostsWithWeights()
Copyright © 2007–2019 Cloudera. All rights reserved.