org.apache.hadoop.dfs
Class DatanodeInfo

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

public class DatanodeInfo
extends DatanodeID
implements 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 suplied 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.dfs.DatanodeID
infoPort, ipcPort, name, storageID
 
Method Summary
 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.
 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
 Node getParent()
          Return this node's parent
 long getRemaining()
          The raw free space.
 int getXceiverCount()
          number of active connections
 void readFields(DataInput in)
          Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

 void setHostName(String host)
           
 void setLevel(int level)
          Set this node's level in the tree.
 void setNetworkLocation(String location)
          Sets the rack name
 void setParent(Node parent)
          Set this node's parent
 void write(DataOutput out)
          Serialize the fields of this object to out.
 
Methods inherited from class org.apache.hadoop.dfs.DatanodeID
compareTo, equals, getHost, getInfoPort, getIpcPort, getName, getPort, getStorageID, hashCode, toString
 
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

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


adminState

protected DatanodeInfo.AdminStates adminState
Method Detail

getCapacity

public long getCapacity()
The raw capacity.


getDfsUsed

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


getRemaining

public long getRemaining()
The raw free space.


getLastUpdate

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


getXceiverCount

public int getXceiverCount()
number of active connections


getNetworkLocation

public String getNetworkLocation()
rack name

Specified by:
getNetworkLocation in interface Node

setNetworkLocation

public void setNetworkLocation(String location)
Sets the rack name

Specified by:
setNetworkLocation in interface 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.


getParent

public Node getParent()
Return this node's parent

Specified by:
getParent in interface Node

setParent

public void setParent(Node parent)
Description copied from interface: Node
Set this node's parent

Specified by:
setParent in interface 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 Node

setLevel

public void setLevel(int level)
Description copied from interface: Node
Set this node's level in the tree.

Specified by:
setLevel in interface Node

write

public void write(DataOutput out)
           throws IOException
Serialize the fields of this object to out.

Specified by:
write in interface Writable
Overrides:
write in class DatanodeID
Parameters:
out - DataOuput to serialize this object into.
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Deserialize the fields of this object from in.

For efficiency, implementations should attempt to re-use storage in the existing object where possible.

Specified by:
readFields in interface Writable
Overrides:
readFields in class DatanodeID
Parameters:
in - DataInput to deseriablize this object from.
Throws:
IOException


Copyright © 2008 The Apache Software Foundation