|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.routing.RouteSet
A set of nodes typically stored in the routing table. The set contains a bounded number of the closest node handles. Since proximity value can change unpredictably, we don't keep the set in sorted order.
Field Summary | |
static short |
TYPE
DESCRIBE THE FIELD |
Constructor Summary | |
RouteSet(InputBuffer buf,
NodeHandleFactory nhf)
Constructor for RouteSet. |
|
RouteSet(int maxSize)
Constructor. |
Method Summary | |
NodeHandle |
closestNode()
Return the closest live node in the set. |
NodeHandle |
closestNode(int minLiveness)
Return the closest live node in the set. |
NodeHandle |
get(Id nid)
Returns the node handle with the matching node id or null if none exists. |
NodeHandle |
get(int i)
Returns the node in the ith position in the set. |
NodeHandle |
getHandle(Id id)
Finds the NodeHandle associated with the Id. |
NodeHandle |
getHandle(int i)
Gets the ith element in the set. |
int |
getIndex(Id nid)
Get the index of the node id. |
int |
getIndex(NodeHandle nh)
Get the index of the node id. |
int |
getIndexHandle(Id id)
Gets the index of the element with the given node id. |
short |
getType()
Gets the Type attribute of the RouteSet object |
boolean |
member(Id nid)
Membership test. |
boolean |
member(NodeHandle nh)
Membership test. |
boolean |
memberHandle(Id id)
Verifies if the set contains this particular id. |
void |
pingAllNew()
Pings all new nodes in the RouteSet. |
boolean |
put(NodeHandle handle)
Puts a node into the set. |
boolean |
putHandle(NodeHandle handle)
Puts a NodeHandle into the set. |
NodeHandle |
remove(Id nid)
Removes a node from a set. |
NodeHandle |
remove(NodeHandle nh)
Removes a node from a set. |
NodeHandle |
removeHandle(Id id)
Removes a node id and its handle from the set. |
void |
serialize(OutputBuffer buf)
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + maxSize + theSize + closest + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + NodeHandle 1st + ... |
void |
setRoutingTable(RoutingTable rt)
Sets the RoutingTable attribute of the RouteSet object |
int |
size()
Return the current size of the set. |
java.lang.String |
toString()
DESCRIBE THE METHOD |
void |
update(java.util.Observable o,
java.lang.Object arg)
Is called by the Observer pattern whenever the liveness or proximity of a registered node handle is changed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final short TYPE
Constructor Detail |
public RouteSet(int maxSize)
maxSize
- the maximum number of nodes that fit in this set.public RouteSet(InputBuffer buf, NodeHandleFactory nhf) throws java.io.IOException
buf
- DESCRIBE THE PARAMETERnhf
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONMethod Detail |
public NodeHandle get(int i)
get
in interface NodeSetI
i
- DESCRIBE THE PARAMETER
public NodeHandle get(Id nid)
get
in interface NodeSetI
nid
- the node id.
public int getIndex(Id nid)
getIndex
in interface NodeSetI
nid
- DESCRIBE THE PARAMETER
public int getIndex(NodeHandle nh)
getIndex
in interface NodeSetI
nh
- DESCRIBE THE PARAMETER
public NodeHandle getHandle(Id id)
getHandle
in interface NodeHandleSet
id
- a node id.
public NodeHandle getHandle(int i)
getHandle
in interface NodeHandleSet
i
- an index.
public int getIndexHandle(Id id) throws java.util.NoSuchElementException
getIndexHandle
in interface NodeHandleSet
id
- the id.
java.util.NoSuchElementException
- DESCRIBE THE EXCEPTIONpublic short getType()
getType
in interface NodeHandleSet
public void setRoutingTable(RoutingTable rt)
rt
- The new RoutingTable valuepublic java.lang.String toString()
public boolean put(NodeHandle handle)
put
in interface NodeSetI
handle
- the handle to put.
public void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
o
- The node handlearg
- the event type (PROXIMITY_CHANGE, DECLARED_LIVE, DECLARED_DEAD)public NodeHandle remove(Id nid)
nid
- the node id to remove.
public NodeHandle remove(NodeHandle nh)
remove
in interface NodeSetI
nh
- DESCRIBE THE PARAMETER
public boolean member(NodeHandle nh)
member
in interface NodeSetI
nh
- DESCRIBE THE PARAMETER
public boolean member(Id nid)
nid
- the node id to membership of.
public int size()
size
in interface NodeSetI
public void pingAllNew()
public NodeHandle closestNode()
public NodeHandle closestNode(int minLiveness)
minLiveness
- DESCRIBE THE PARAMETER
public boolean putHandle(NodeHandle handle)
putHandle
in interface NodeHandleSet
handle
- the handle to put.
public boolean memberHandle(Id id)
memberHandle
in interface NodeHandleSet
id
- a node id.
public NodeHandle removeHandle(Id id)
removeHandle
in interface NodeHandleSet
id
- DESCRIBE THE PARAMETER
public void serialize(OutputBuffer buf) throws java.io.IOException
serialize
in interface NodeHandleSet
buf
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTION
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |