@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.
|
Modifier and Type | Field and Description |
---|---|
private Map<String,HDFSBlocksDistribution.HostAndWeight> |
hostAndWeights |
private long |
uniqueBlocksTotalWeight |
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
|
private void |
addHostAndBlockWeight(String host,
long weight)
add some weight to a specific host
|
void |
addHostsAndBlockWeight(String[] hosts,
long weight)
add some weight to a list of hosts, update the value of unique block weight
|
private void |
addUniqueWeight(long weight)
add some weight to the total unique 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() |
private Map<String,HDFSBlocksDistribution.HostAndWeight> hostAndWeights
private long uniqueBlocksTotalWeight
public String toString()
toString
in class Object
Object.toString()
public void addHostsAndBlockWeight(String[] hosts, long weight)
hosts
- the list of the hostweight
- the weightprivate void addUniqueWeight(long weight)
weight
- the weightprivate void addHostAndBlockWeight(String host, long weight)
host
- the host nameweight
- 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 The Apache Software Foundation. All rights reserved.