@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.
|
static interface |
HDFSBlocksDistribution.Visitor
Implementations 'visit' hostAndWeight.
|
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,
long weightForSsd)
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
|
void |
addHostsAndBlockWeight(String[] hosts,
long weight,
org.apache.hadoop.fs.StorageType[] storageTypes)
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) |
float |
getBlockLocalityIndexForSsd(String host) |
private long |
getBlocksLocalityWeightInternal(String host,
HDFSBlocksDistribution.Visitor visitor) |
long |
getBlocksLocalWeight(String host) |
long |
getBlocksLocalWithSsdWeight(String 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 HDFSBlocksDistribution()
public String toString()
toString
in class Object
Object.toString()
public void addHostsAndBlockWeight(String[] hosts, long weight)
hosts
- the list of the hostweight
- the weightpublic void addHostsAndBlockWeight(String[] hosts, long weight, org.apache.hadoop.fs.StorageType[] storageTypes)
hosts
- the list of the hostweight
- the weightprivate void addUniqueWeight(long weight)
weight
- the weightprivate void addHostAndBlockWeight(String host, long weight, long weightForSsd)
host
- the host nameweight
- the weightweightForSsd
- the weight for ssdpublic 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 float getBlockLocalityIndexForSsd(String host)
host
- the host namepublic long getBlocksLocalWeight(String host)
host
- the host namepublic long getBlocksLocalWithSsdWeight(String host)
host
- the host nameprivate long getBlocksLocalityWeightInternal(String host, HDFSBlocksDistribution.Visitor visitor)
host
- the host namepublic void add(HDFSBlocksDistribution otherBlocksDistribution)
otherBlocksDistribution
- the other hdfs blocks distributionpublic List<String> getTopHosts()
public HDFSBlocksDistribution.HostAndWeight[] getTopHostsWithWeights()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.