org.apache.hadoop.hbase
Class HDFSBlocksDistribution

java.lang.Object
  extended by org.apache.hadoop.hbase.HDFSBlocksDistribution

@InterfaceAudience.Private
public class HDFSBlocksDistribution
extends Object

Data structure to describe the distribution of HDFS blocks amount hosts. Adding erroneous data will be ignored silently.


Nested Class Summary
static class HDFSBlocksDistribution.HostAndWeight
          Stores the hostname and weight for that hostname.
 
Constructor Summary
HDFSBlocksDistribution()
          Constructor
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HDFSBlocksDistribution

public HDFSBlocksDistribution()
Constructor

Method Detail

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

addHostsAndBlockWeight

public void addHostsAndBlockWeight(String[] hosts,
                                   long weight)
add some weight to a list of hosts, update the value of unique block weight

Parameters:
hosts - the list of the host
weight - the weight

getHostAndWeights

public Map<String,HDFSBlocksDistribution.HostAndWeight> getHostAndWeights()
Returns:
the hosts and their weights

getWeight

public long getWeight(String host)
return the weight for a specific host, that will be the total bytes of all blocks on the host

Parameters:
host - the host name
Returns:
the weight of the given host

getUniqueBlocksTotalWeight

public long getUniqueBlocksTotalWeight()
Returns:
the sum of all unique blocks' weight

getBlockLocalityIndex

public float getBlockLocalityIndex(String host)
return the locality index of a given host

Parameters:
host - the host name
Returns:
the locality index of the given host

add

public void add(HDFSBlocksDistribution otherBlocksDistribution)
This will add the distribution from input to this object

Parameters:
otherBlocksDistribution - the other hdfs blocks distribution

getTopHosts

public List<String> getTopHosts()
return the sorted list of hosts in terms of their weights


getTopHostsWithWeights

public HDFSBlocksDistribution.HostAndWeight[] getTopHostsWithWeights()
return the sorted list of hosts in terms of their weights



Copyright © 2015 The Apache Software Foundation. All rights reserved.