ostore.util
Class NodeId
java.lang.Object
|
+--ostore.util.NodeId
- All Implemented Interfaces:
- Digestible, QuickSerializable
- Direct Known Subclasses:
- MyNodeId
- public class NodeId
- extends Object
- implements Digestible
Abstract node identifier. Currently we use 32-bit IPv4 addressed.
- Version:
- $Id: NodeId.java,v 1.10 2002/04/04 05:02:48 hweather Exp $
- Author:
- Sean C. Rhea
Constructor Summary |
|
NodeId()
|
|
NodeId(byte[] data,
int[] offset)
|
protected |
NodeId(int port,
InetAddress addr)
Construct a new NodeId. |
|
NodeId(String peer)
Read this NodeId in from a string of the same format as produced by
toString (), below. |
Method Summary |
void |
add_to_digest(SecureHashBuffer buffer)
Specified by ostore.util.Digestible |
InetAddress |
address()
Return the InetAddress associated with this NodeId; does not work
under the simulator. |
boolean |
equals(Object other)
|
int |
hashCode()
|
boolean |
less_than(NodeId other)
a.less_than (b) returns true iff a is less
than b . |
int |
port()
|
void |
to_bytes(byte[] data,
int[] offset)
Store the object in its "on the wire" form in the byte array
data , starting at index offset [0] , and
increment offset [0] by the number of bytes written;
if data == null , increment offset [0] by
the number of bytes that would have been written otherwise. |
String |
toString()
|
int |
type_code()
Returns the unique integer associated with this class in the
TypeTable . |
DEBUG
public static final boolean DEBUG
TYPE_CODE
public static final int TYPE_CODE
NodeId
protected NodeId(int port,
InetAddress addr)
- Construct a new NodeId.
- Parameters:
port
- The network port; must be between 0 and 65535 inclusive.addr
- The IP address
NodeId
public NodeId(String peer)
throws NodeId.BadFormat,
UnknownHostException
- Read this NodeId in from a string of the same format as produced by
toString (), below.
NodeId
public NodeId()
NodeId
public NodeId(byte[] data,
int[] offset)
to_bytes
public void to_bytes(byte[] data,
int[] offset)
- Description copied from interface:
QuickSerializable
- Store the object in its "on the wire" form in the byte array
data
, starting at index offset [0]
, and
increment offset [0]
by the number of bytes written;
if data == null
, increment offset [0]
by
the number of bytes that would have been written otherwise.
- Specified by:
to_bytes
in interface QuickSerializable
- Following copied from interface:
ostore.util.QuickSerializable
- Parameters:
data
- The byte array to store into, or null
.offset
- A single element array whose first
element is the index in data to begin writing at on
function entry, and which on function exit has been
incremented by the number of bytes written.
add_to_digest
public void add_to_digest(SecureHashBuffer buffer)
- Specified by ostore.util.Digestible
- Specified by:
add_to_digest
in interface Digestible
- Following copied from interface:
ostore.util.Digestible
- See Also:
SecureHashBuffer.add( byte )
,
SecureHashBuffer.add( byte[] )
,
SecureHashBuffer.add( byte[], int, int )
,
SecureHashBuffer.add( Digestible )
type_code
public int type_code()
- Description copied from interface:
QuickSerializable
- Returns the unique integer associated with this class in the
TypeTable
.
- Specified by:
type_code
in interface QuickSerializable
- Following copied from interface:
ostore.util.QuickSerializable
- Returns:
- an integer unique to this class
address
public InetAddress address()
- Return the InetAddress associated with this NodeId; does not work
under the simulator.
JUST TO MAKE THAT CLEAR, THIS FUNCTION WILL NOT WORK IN THE
OCEANSTORE SIMULATOR. YOU HAVE BEEN WARNED.
port
public int port()
toString
public String toString()
- Overrides:
toString
in class Object
equals
public boolean equals(Object other)
- Overrides:
equals
in class Object
less_than
public boolean less_than(NodeId other)
a.less_than (b)
returns true iff a
is less
than b
. Used for sorting NodeId
s.
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object