|
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.commonapi.PastryEndpoint
This class serves as gluecode, which allows applications written for the common API to work with pastry.
Field Summary | |
protected rice.p2p.commonapi.Application |
application
|
protected rice.pastry.security.Credentials |
credentials
|
Fields inherited from class rice.pastry.client.PastryAppl |
address, instance, thePastryNode |
Constructor Summary | |
PastryEndpoint(rice.pastry.PastryNode pn,
rice.p2p.commonapi.Application application,
java.lang.String instance)
Constructor. |
Method Summary | |
boolean |
enrouteMessage(rice.p2p.commonapi.Message msg,
rice.p2p.commonapi.Id key,
rice.pastry.NodeId nextHop,
rice.pastry.routing.SendOptions opt)
|
rice.pastry.security.Credentials |
getCredentials()
Returns the credentials of this application. |
rice.p2p.commonapi.Id |
getId()
Returns this node's id, which is its identifier in the namespace. |
rice.p2p.commonapi.NodeHandle |
getLocalNodeHandle()
Returns a handle to the local node below this endpoint. |
void |
leafSetChange(rice.pastry.NodeHandle nh,
boolean wasAdded)
Called by pastry when the leaf set changes. |
rice.p2p.commonapi.NodeHandleSet |
localLookup(rice.p2p.commonapi.Id key,
int num,
boolean safe)
This method produces a list of nodes that can be used as next hops on a route towards key, such that the resulting route satisfies the overlay protocol's bounds on the number of hops taken. |
void |
messageForAppl(rice.pastry.messaging.Message msg)
Called by pastry when a message arrives for this application. |
rice.p2p.commonapi.NodeHandleSet |
neighborSet(int num)
This method produces an unordered list of nodehandles that are neighbors of the local node in the ID space. |
rice.p2p.commonapi.IdRange |
range(rice.p2p.commonapi.NodeHandle n,
int r,
rice.p2p.commonapi.Id key)
This method provides information about ranges of keys for which the node n is currently a r-root. |
rice.p2p.commonapi.IdRange |
range(rice.p2p.commonapi.NodeHandle n,
int r,
rice.p2p.commonapi.Id key,
boolean cumulative)
This method provides information about ranges of keys for which the node n is currently a r-root. |
void |
receiveMessage(rice.pastry.messaging.Message msg)
Called by pastry to deliver a message to this client. |
rice.p2p.commonapi.NodeHandleSet |
replicaSet(rice.p2p.commonapi.Id key,
int max_rank)
This method returns an ordered set of nodehandles on which replicas of the object with key can be stored. |
void |
route(rice.p2p.commonapi.Id key,
rice.p2p.commonapi.Message msg,
rice.p2p.commonapi.NodeHandle hint)
This operation forwards a message towards the root of key. |
void |
scheduleMessage(rice.p2p.commonapi.Message message,
long delay)
Schedules a message to be delivered to this application after the provided number of milliseconds. |
Methods inherited from class rice.pastry.client.PastryAppl |
enrouteMessage, getAddress, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, notifyReady, registerReceiver, routeMsg, routeMsgDirect, routeSetChange, sendMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected rice.pastry.security.Credentials credentials
protected rice.p2p.commonapi.Application application
Constructor Detail |
public PastryEndpoint(rice.pastry.PastryNode pn, rice.p2p.commonapi.Application application, java.lang.String instance)
pn
- the pastry node that the application attaches to.Method Detail |
public rice.p2p.commonapi.Id getId()
getId
in interface Endpoint
public void route(rice.p2p.commonapi.Id key, rice.p2p.commonapi.Message msg, rice.p2p.commonapi.NodeHandle hint)
route
in interface Endpoint
key
- the keymsg
- the message to deliver.hint
- the hintpublic void scheduleMessage(rice.p2p.commonapi.Message message, long delay)
scheduleMessage
in interface Endpoint
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the messagepublic rice.p2p.commonapi.NodeHandleSet localLookup(rice.p2p.commonapi.Id key, int num, boolean safe)
localLookup
in interface Endpoint
key
- the message's keynum
- the maximal number of next hops nodes requestedsafe
-
public rice.p2p.commonapi.NodeHandleSet neighborSet(int num)
neighborSet
in interface Endpoint
num
- the maximal number of nodehandles requested
public rice.p2p.commonapi.NodeHandleSet replicaSet(rice.p2p.commonapi.Id key, int max_rank)
replicaSet
in interface Endpoint
key
- the keymax_rank
- the maximal number of nodehandles returned
public rice.p2p.commonapi.IdRange range(rice.p2p.commonapi.NodeHandle n, int r, rice.p2p.commonapi.Id key, boolean cumulative)
n
- nodeHandle of the node whose range is being queriedr
- the rankkey
- the keycumulative
- if true, returns ranges for which n is an i-root for 0Returns:public rice.p2p.commonapi.IdRange range(rice.p2p.commonapi.NodeHandle n, int r, rice.p2p.commonapi.Id key)
range
in interface Endpoint
n
- nodeHandle of the node whose range is being queriedr
- the rankkey
- the key
public rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
getLocalNodeHandle
in interface Endpoint
public final void messageForAppl(rice.pastry.messaging.Message msg)
PastryAppl
messageForAppl
in class PastryAppl
msg
- the message that is arriving.public final boolean enrouteMessage(rice.p2p.commonapi.Message msg, rice.p2p.commonapi.Id key, rice.pastry.NodeId nextHop, rice.pastry.routing.SendOptions opt)
public void leafSetChange(rice.pastry.NodeHandle nh, boolean wasAdded)
PastryAppl
leafSetChange
in class PastryAppl
nh
- the handle of the node that was added or removed.wasAdded
- true if the node was added, false if the node was removed.public rice.pastry.security.Credentials getCredentials()
getCredentials
in class PastryAppl
public void receiveMessage(rice.pastry.messaging.Message msg)
receiveMessage
in interface MessageReceiver
receiveMessage
in class PastryAppl
msg
- the message that is arriving.
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |