|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.client.PastryAppl rice.pastry.pns.PNSApplication
public class PNSApplication
Can request LeafSet, RouteRow, Proximity of nodes, implements the PNS algorithm. Flow: call getLeafSet(...) addToWaitingForLeafSet() cancellable.cancel() removeFromWaitingForLeafSet() TODO: Make use the environment's clock for the wait() calls.
Field Summary | |
---|---|
static int |
DEFAULT_PROXIMITY
|
protected Environment |
environment
|
protected java.util.Map<NodeHandle,java.lang.Integer> |
pingCache
Hashtable which keeps track of temporary ping values, which are only used during the getNearest() method |
protected byte |
rtBase
|
protected Timer |
timer
|
Fields inherited from class rice.pastry.client.PastryAppl |
---|
address, deserializer, instance, logger, options, receiver, thePastryNode |
Constructor Summary | |
---|---|
PNSApplication(PastryNode pn)
|
|
PNSApplication(PastryNode pn,
Logger logger)
|
Method Summary | |
---|---|
protected void |
addToWaitingForLeafSet(NodeHandle handle,
Continuation<LeafSet,java.lang.Exception> c,
Cancellable cancelMeWhenSuccess)
|
protected void |
addToWaitingForRouteRow(NodeHandle handle,
int row,
Continuation<RouteSet[],java.lang.Exception> c,
Cancellable cancelMeWhenSuccess)
|
boolean |
deliverWhenNotReady()
We always want to receive messages. |
Cancellable |
getLeafSet(NodeHandle handle,
Continuation<LeafSet,java.lang.Exception> c)
This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion. |
Cancellable |
getNearest(NodeHandle seed,
Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> retToMe)
This method implements the algorithm in the Pastry locality paper for finding a close node the the current node through iterative leafset and route row requests. |
Cancellable |
getNearHandles(java.util.Collection<NodeHandle> bootHandles,
Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> deliverResultToMe)
|
protected java.util.List<NodeHandle> |
getNearHandlesHelper(java.util.List<NodeHandle> handles)
Helper for getNearHandles Can be overridden to select out any handles that shouldn't be returned. |
Cancellable |
getProximity(NodeHandle handle,
Continuation<java.lang.Integer,java.io.IOException> c,
int timeout)
Non-blocking version, no timeout. |
Cancellable |
getRouteRow(NodeHandle handle,
short row,
Continuation<RouteSet[],java.lang.Exception> c)
Non-blocking version. |
void |
messageForAppl(Message msg)
Called by pastry when a message arrives for this application. |
void |
proximityChanged(NodeHandle i,
int newProximity,
java.util.Map<java.lang.String,java.lang.Object> options)
|
protected boolean |
removeFromWaitingForLeafSet(NodeHandle handle,
Continuation<LeafSet,java.lang.Exception> c)
|
protected boolean |
removeFromWaitingForRouteRow(NodeHandle handle,
int row,
Continuation<RouteSet[],java.lang.Exception> c)
|
java.util.List<NodeHandle> |
sortedProximityCache()
|
Methods inherited from class rice.pastry.client.PastryAppl |
---|
accept, canReceiveSocket, connect, destroy, enrouteMessage, finishReceiveSocket, getAddress, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, notifyReady, receiveMessage, receiveMessageInternal, register, routeMsg, routeMsg, routeMsgDirect, routeSetChange, setDeserializer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PROXIMITY
protected java.util.Map<NodeHandle,java.lang.Integer> pingCache
protected final byte rtBase
protected Environment environment
protected Timer timer
Constructor Detail |
---|
public PNSApplication(PastryNode pn)
public PNSApplication(PastryNode pn, Logger logger)
Method Detail |
---|
public boolean deliverWhenNotReady()
deliverWhenNotReady
in class PastryAppl
public void messageForAppl(Message msg)
PastryAppl
messageForAppl
in class PastryAppl
msg
- the message that is arriving.public Cancellable getNearHandles(java.util.Collection<NodeHandle> bootHandles, Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> deliverResultToMe)
getNearHandles
in interface ProximityNeighborSelector
protected java.util.List<NodeHandle> getNearHandlesHelper(java.util.List<NodeHandle> handles)
handles
-
public Cancellable getLeafSet(NodeHandle handle, Continuation<LeafSet,java.lang.Exception> c)
handle
- The node to connect toc
- Continuation to return the LeafSet to
java.io.IOException
protected void addToWaitingForLeafSet(NodeHandle handle, Continuation<LeafSet,java.lang.Exception> c, Cancellable cancelMeWhenSuccess)
protected boolean removeFromWaitingForLeafSet(NodeHandle handle, Continuation<LeafSet,java.lang.Exception> c)
public Cancellable getRouteRow(NodeHandle handle, short row, Continuation<RouteSet[],java.lang.Exception> c)
handle
- row
- c
-
java.io.IOException
protected void addToWaitingForRouteRow(NodeHandle handle, int row, Continuation<RouteSet[],java.lang.Exception> c, Cancellable cancelMeWhenSuccess)
protected boolean removeFromWaitingForRouteRow(NodeHandle handle, int row, Continuation<RouteSet[],java.lang.Exception> c)
public Cancellable getProximity(NodeHandle handle, Continuation<java.lang.Integer,java.io.IOException> c, int timeout)
handle
- c
- public void proximityChanged(NodeHandle i, int newProximity, java.util.Map<java.lang.String,java.lang.Object> options)
proximityChanged
in interface ProximityListener<NodeHandle>
public java.util.List<NodeHandle> sortedProximityCache()
public Cancellable getNearest(NodeHandle seed, Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> retToMe)
seed
- Any member of the pastry ring
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |