org.apache.hadoop.dfs
Class DatanodeInfo

java.lang.Object
  extended by org.apache.hadoop.dfs.DatanodeInfo
All Implemented Interfaces:
Comparable, Writable

public class DatanodeInfo
extends Object
implements Writable, Comparable

DatanodeInfo tracks stats on a given DataNode, such as available storage capacity, last update time, etc.

Author:
Mike Cafarella

Field Summary
protected  String name
           
protected  String storageID
           
 
Constructor Summary
DatanodeInfo()
          Create an empty DatanodeInfo.
DatanodeInfo(org.apache.hadoop.dfs.DatanodeID nodeID)
           
DatanodeInfo(org.apache.hadoop.dfs.DatanodeID nodeID, long capacity, long remaining)
          Create an empty DatanodeInfo.
DatanodeInfo(String name, String storageID, long capacity, long remaining)
           
 
Method Summary
 void addBlock(org.apache.hadoop.dfs.Block b)
           
 int compareTo(Object o)
          Comparable.
 Iterator getBlockIterator()
           
 org.apache.hadoop.dfs.Block[] getBlocks()
           
 long getCapacity()
           
 String getHost()
           
 String getName()
           
 long getRemaining()
           
 String getStorageID()
           
 long lastUpdate()
           
 void readFields(DataInput in)
          Reads the fields of this object from in.
 String toString()
           
 void updateBlocks(org.apache.hadoop.dfs.Block[] newBlocks)
           
 void updateHeartbeat(long capacity, long remaining)
           
 void write(DataOutput out)
          Writes the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name

storageID

protected String storageID
Constructor Detail

DatanodeInfo

public DatanodeInfo()
Create an empty DatanodeInfo.


DatanodeInfo

public DatanodeInfo(org.apache.hadoop.dfs.DatanodeID nodeID)

DatanodeInfo

public DatanodeInfo(org.apache.hadoop.dfs.DatanodeID nodeID,
                    long capacity,
                    long remaining)
Create an empty DatanodeInfo.


DatanodeInfo

public DatanodeInfo(String name,
                    String storageID,
                    long capacity,
                    long remaining)
Parameters:
name - hostname:portNumber as String object.
Method Detail

updateBlocks

public void updateBlocks(org.apache.hadoop.dfs.Block[] newBlocks)

addBlock

public void addBlock(org.apache.hadoop.dfs.Block b)

updateHeartbeat

public void updateHeartbeat(long capacity,
                            long remaining)

getBlocks

public org.apache.hadoop.dfs.Block[] getBlocks()

getBlockIterator

public Iterator getBlockIterator()

getCapacity

public long getCapacity()

getRemaining

public long getRemaining()

lastUpdate

public long lastUpdate()

compareTo

public int compareTo(Object o)
Comparable. Basis of compare is the String name (host:portNumber) only.

Specified by:
compareTo in interface Comparable
Parameters:
o -
Returns:
as specified by Comparable.

write

public void write(DataOutput out)
           throws IOException
Description copied from interface: Writable
Writes the fields of this object to out.

Specified by:
write in interface Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Description copied from interface: Writable
Reads 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
Throws:
IOException

getName

public String getName()
Returns:
hostname:portNumber.

getStorageID

public String getStorageID()
Returns:
data storage ID.

getHost

public String getHost()
Returns:
hostname and no :portNumber.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006 The Apache Software Foundation