org.apache.hadoop.hdfs.protocol
Class DatanodeInfo

java.lang.Object
  extended by org.apache.hadoop.hdfs.protocol.DatanodeID
      extended by org.apache.hadoop.hdfs.protocol.DatanodeInfo
All Implemented Interfaces:
Comparable<DatanodeID>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<DatanodeID>, org.apache.hadoop.net.Node
Direct Known Subclasses:
DatanodeDescriptor

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class DatanodeInfo
extends DatanodeID
implements org.apache.hadoop.net.Node

DatanodeInfo represents the status of a DataNode. This object is used for communication in the Datanode Protocol and the Client Protocol.


Nested Class Summary
static class DatanodeInfo.AdminStates
           
 
Field Summary
protected  DatanodeInfo.AdminStates adminState
           
protected  long capacity
           
protected  long dfsUsed
           
protected  String hostName
          HostName as supplied by the datanode during registration as its name.
protected  long lastUpdate
           
protected  String location
           
protected  long remaining
           
protected  int xceiverCount
           
 
Fields inherited from class org.apache.hadoop.hdfs.protocol.DatanodeID
EMPTY_ARRAY, infoPort, ipcPort, name, storageID
 
Constructor Summary
  DatanodeInfo()
           
  DatanodeInfo(DatanodeID nodeID)
           
protected DatanodeInfo(DatanodeID nodeID, String location, String hostName)
           
  DatanodeInfo(DatanodeInfo from)
           
 
Method Summary
 String dumpDatanode()
          A formatted string for printing the status of the DataNode.
 boolean equals(Object obj)
           
 long getCapacity()
          The raw capacity.
 String getDatanodeReport()
          A formatted string for reporting the status of the DataNode.
 long getDfsUsed()
          The used space by the data node.
 float getDfsUsedPercent()
          The used space by the data node as percentage of present capacity
 String getHostName()
           
 long getLastUpdate()
          The time when this information was accurate.
 int getLevel()
          Return this node's level in the tree.
 String getNetworkLocation()
          rack name
 long getNonDfsUsed()
          The used space by the data node.
 org.apache.hadoop.net.Node getParent()
          Return this node's parent
 long getRemaining()
          The raw free space.
 float getRemainingPercent()
          The remaining space as percentage of configured capacity.
 int getXceiverCount()
          number of active connections
 int hashCode()
           
 boolean isDecommissioned()
          Returns true if the node has been decommissioned.
 boolean isDecommissionInProgress()
          Returns true if the node is in the process of being decommissioned
static DatanodeInfo read(DataInput in)
          Read a DatanodeInfo
 void readFields(DataInput in)
          
protected  void setAdminState(DatanodeInfo.AdminStates newState)
          Sets the admin state of this node.
 void setCapacity(long capacity)
          Sets raw capacity.
 void setDecommissioned()
          Sets the admin state to indicate that decommission is complete.
 void setHostName(String host)
           
 void setLastUpdate(long lastUpdate)
          Sets time when this information was accurate.
 void setLevel(int level)
           
 void setNetworkLocation(String location)
          Sets the rack name
 void setParent(org.apache.hadoop.net.Node parent)
           
 void setRemaining(long remaining)
          Sets raw free space.
 void setXceiverCount(int xceiverCount)
          Sets number of active connections
 void startDecommission()
          Start decommissioning a node.
 void stopDecommission()
          Stop decommissioning a node.
 void write(DataOutput out)
          
 
Methods inherited from class org.apache.hadoop.hdfs.protocol.DatanodeID
compareTo, getHost, getInfoPort, getIpcPort, getName, getPort, getStorageID, setStorageID, toString, updateRegInfo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.net.Node
getName
 

Field Detail

capacity

protected long capacity

dfsUsed

protected long dfsUsed

remaining

protected long remaining

lastUpdate

protected long lastUpdate

xceiverCount

protected int xceiverCount

location

protected String location

hostName

@Nullable
protected String hostName
HostName as supplied by the datanode during registration as its name. Namenode uses datanode IP address as the name.


adminState

@Nullable
protected DatanodeInfo.AdminStates adminState
Constructor Detail

DatanodeInfo

public DatanodeInfo()

DatanodeInfo

public DatanodeInfo(DatanodeInfo from)

DatanodeInfo

public DatanodeInfo(DatanodeID nodeID)

DatanodeInfo

protected DatanodeInfo(DatanodeID nodeID,
                       String location,
                       String hostName)
Method Detail

getCapacity

public long getCapacity()
The raw capacity.


getDfsUsed

public long getDfsUsed()
The used space by the data node.


getNonDfsUsed

public long getNonDfsUsed()
The used space by the data node.


getDfsUsedPercent

public float getDfsUsedPercent()
The used space by the data node as percentage of present capacity


getRemaining

public long getRemaining()
The raw free space.


getRemainingPercent

public float getRemainingPercent()
The remaining space as percentage of configured capacity.


getLastUpdate

public long getLastUpdate()
The time when this information was accurate.


getXceiverCount

public int getXceiverCount()
number of active connections


setCapacity

public void setCapacity(long capacity)
Sets raw capacity.


setRemaining

public void setRemaining(long remaining)
Sets raw free space.


setLastUpdate

public void setLastUpdate(long lastUpdate)
Sets time when this information was accurate.


setXceiverCount

public void setXceiverCount(int xceiverCount)
Sets number of active connections


getNetworkLocation

public String getNetworkLocation()
rack name

Specified by:
getNetworkLocation in interface org.apache.hadoop.net.Node

setNetworkLocation

public void setNetworkLocation(String location)
Sets the rack name

Specified by:
setNetworkLocation in interface org.apache.hadoop.net.Node

getHostName

public String getHostName()

setHostName

public void setHostName(String host)

getDatanodeReport

public String getDatanodeReport()
A formatted string for reporting the status of the DataNode.


dumpDatanode

public String dumpDatanode()
A formatted string for printing the status of the DataNode.


startDecommission

public void startDecommission()
Start decommissioning a node. old state.


stopDecommission

public void stopDecommission()
Stop decommissioning a node. old state.


isDecommissionInProgress

public boolean isDecommissionInProgress()
Returns true if the node is in the process of being decommissioned


isDecommissioned

public boolean isDecommissioned()
Returns true if the node has been decommissioned.


setDecommissioned

public void setDecommissioned()
Sets the admin state to indicate that decommission is complete.


setAdminState

protected void setAdminState(DatanodeInfo.AdminStates newState)
Sets the admin state of this node.


getParent

public org.apache.hadoop.net.Node getParent()
Return this node's parent

Specified by:
getParent in interface org.apache.hadoop.net.Node

setParent

public void setParent(org.apache.hadoop.net.Node parent)
Specified by:
setParent in interface org.apache.hadoop.net.Node

getLevel

public int getLevel()
Return this node's level in the tree. E.g. the root of a tree returns 0 and its children return 1

Specified by:
getLevel in interface org.apache.hadoop.net.Node

setLevel

public void setLevel(int level)
Specified by:
setLevel in interface org.apache.hadoop.net.Node

write

public void write(DataOutput out)
           throws IOException

Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class DatanodeID
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Overrides:
readFields in class DatanodeID
Throws:
IOException

read

public static DatanodeInfo read(DataInput in)
                         throws IOException
Read a DatanodeInfo

Throws:
IOException

hashCode

public int hashCode()
Overrides:
hashCode in class DatanodeID

equals

public boolean equals(Object obj)
Overrides:
equals in class DatanodeID


Copyright © 2009 The Apache Software Foundation