org.apache.hadoop.hbase.rest.model
Class StorageClusterStatusModel

java.lang.Object
  extended by org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel
All Implemented Interfaces:
Serializable, ProtobufMessageHandler

public class StorageClusterStatusModel
extends Object
implements Serializable, ProtobufMessageHandler

Representation of the status of a storage cluster:

 <complexType name="StorageClusterStatus">
   <sequence>
     <element name="liveNode" type="tns:Node"
       maxOccurs="unbounded" minOccurs="0">
     </element>
     <element name="deadNode" type="string" maxOccurs="unbounded"
       minOccurs="0">
     </element>
   </sequence>
   <attribute name="regions" type="int"></attribute>
   <attribute name="requests" type="int"></attribute>
   <attribute name="averageLoad" type="float"></attribute>
 </complexType>

 <complexType name="Node">
   <sequence>
     <element name="region" type="tns:Region" 
       maxOccurs="unbounded" minOccurs="0"></element>
   </sequence>
   <attribute name="name" type="string"></attribute>
   <attribute name="startCode" type="int"></attribute>
   <attribute name="requests" type="int"></attribute>
   <attribute name="heapSizeMB" type="int"></attribute>
   <attribute name="maxHeapSizeMB" type="int"></attribute>
 </complexType>

 <complexType name="Region">
   <attribute name="name" type="base64Binary"></attribute>
   <attribute name="stores" type="int"></attribute>
   <attribute name="storefiles" type="int"></attribute>
   <attribute name="storefileSizeMB" type="int"></attribute>
   <attribute name="memstoreSizeMB" type="int"></attribute>
   <attribute name="storefileIndexSizeMB" type="int"></attribute>
 </complexType>
 

See Also:
Serialized Form

Nested Class Summary
static class StorageClusterStatusModel.Node
          Represents a region server.
 
Constructor Summary
StorageClusterStatusModel()
          Default constructor
 
Method Summary
 void addDeadNode(String node)
          Add a dead node to the cluster representation.
 StorageClusterStatusModel.Node addLiveNode(String name, long startCode, int heapSizeMB, int maxHeapSizeMB)
          Add a live node to the cluster representation.
 byte[] createProtobufOutput()
           
 double getAverageLoad()
           
 String getDeadNode(int index)
           
 List<String> getDeadNodes()
           
 StorageClusterStatusModel.Node getLiveNode(int index)
           
 List<StorageClusterStatusModel.Node> getLiveNodes()
           
 ProtobufMessageHandler getObjectFromMessage(byte[] message)
          Initialize the model from a protobuf representation.
 int getRegions()
           
 int getRequests()
           
 void setAverageLoad(double averageLoad)
           
 void setDeadNodes(List<String> nodes)
           
 void setLiveNodes(List<StorageClusterStatusModel.Node> nodes)
           
 void setRegions(int regions)
           
 void setRequests(int requests)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StorageClusterStatusModel

public StorageClusterStatusModel()
Default constructor

Method Detail

addLiveNode

public StorageClusterStatusModel.Node addLiveNode(String name,
                                                  long startCode,
                                                  int heapSizeMB,
                                                  int maxHeapSizeMB)
Add a live node to the cluster representation.

Parameters:
name - the region server name
startCode - the region server's start code
heapSizeMB - the current heap size, in MB
maxHeapSizeMB - the maximum heap size, in MB

getLiveNode

public StorageClusterStatusModel.Node getLiveNode(int index)
Parameters:
index - the index
Returns:
the region server model

addDeadNode

public void addDeadNode(String node)
Add a dead node to the cluster representation.

Parameters:
node - the dead region server's name

getDeadNode

public String getDeadNode(int index)
Parameters:
index - the index
Returns:
the dead region server's name

getLiveNodes

public List<StorageClusterStatusModel.Node> getLiveNodes()
Returns:
the list of live nodes

getDeadNodes

public List<String> getDeadNodes()
Returns:
the list of dead nodes

getRegions

public int getRegions()
Returns:
the total number of regions served by the cluster

getRequests

public int getRequests()
Returns:
the total number of requests per second handled by the cluster in the last reporting interval

getAverageLoad

public double getAverageLoad()
Returns:
the average load of the region servers in the cluster

setLiveNodes

public void setLiveNodes(List<StorageClusterStatusModel.Node> nodes)
Parameters:
nodes - the list of live node models

setDeadNodes

public void setDeadNodes(List<String> nodes)
Parameters:
nodes - the list of dead node names

setRegions

public void setRegions(int regions)
Parameters:
regions - the total number of regions served by the cluster

setRequests

public void setRequests(int requests)
Parameters:
requests - the total number of requests per second handled by the cluster

setAverageLoad

public void setAverageLoad(double averageLoad)
Parameters:
averageLoad - the average load of region servers in the cluster

toString

public String toString()
Overrides:
toString in class Object

createProtobufOutput

public byte[] createProtobufOutput()
Specified by:
createProtobufOutput in interface ProtobufMessageHandler
Returns:
the protobuf represention of the model

getObjectFromMessage

public ProtobufMessageHandler getObjectFromMessage(byte[] message)
                                            throws IOException
Description copied from interface: ProtobufMessageHandler
Initialize the model from a protobuf representation.

Specified by:
getObjectFromMessage in interface ProtobufMessageHandler
Parameters:
message - the raw bytes of the protobuf message
Returns:
reference to self for convenience
Throws:
IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.