org.apache.hadoop.dfs
Class DatanodeID

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

public class DatanodeID
extends Object
implements WritableComparable

DatanodeID is composed of the data node name (hostname:portNumber) and the data storage ID, which it currently represents.

Author:
Konstantin Shvachko

Field Summary
protected  int infoPort
           
protected  String name
           
protected  String storageID
           
 
Constructor Summary
DatanodeID()
          DatanodeID default constructor
DatanodeID(DatanodeID from)
          DatanodeID copy constructor
DatanodeID(String nodeName, String storageID, int infoPort)
          Create DatanodeID
 
Method Summary
 int compareTo(Object o)
          Comparable.
 boolean equals(Object to)
           
 String getHost()
           
 int getInfoPort()
           
 String getName()
           
 int getPort()
           
 String getStorageID()
           
 int hashCode()
           
 void readFields(DataInput in)
          Reads the fields of this object from in.
 String toString()
           
 void write(DataOutput out)
          Writes the fields of this object to out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name

storageID

protected String storageID

infoPort

protected int infoPort
Constructor Detail

DatanodeID

public DatanodeID()
DatanodeID default constructor


DatanodeID

public DatanodeID(DatanodeID from)
DatanodeID copy constructor

Parameters:
from -

DatanodeID

public DatanodeID(String nodeName,
                  String storageID,
                  int infoPort)
Create DatanodeID

Parameters:
nodeName - (hostname:portNumber)
storageID - data storage ID
Method Detail

getName

public String getName()
Returns:
hostname:portNumber.

getStorageID

public String getStorageID()
Returns:
data storage ID.

getInfoPort

public int getInfoPort()
Returns:
infoPort (the port at which the HTTP server bound to)

getHost

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

getPort

public int getPort()

equals

public boolean equals(Object to)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

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


Copyright © 2006 The Apache Software Foundation