|
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.client.CommonAPIAppl
public abstract class CommonAPIAppl
CommonAPIAppl is an abstract class that all new applications should extend. It provides the common KBR API defined in "Towards a Common API for Structured Peer-to-Peer Overlays." Frank Dabek, Ben Zhao, Peter Druschel, John Kubiatowicz and Ion Stoica. In Proceedings of the 2nd International Workshop on Peer-to-peer Systems (IPTPS'03) , Berkeley, CA, February 2003.
Field Summary |
---|
Fields inherited from class rice.pastry.client.PastryAppl |
---|
address, deserializer, instance, logger, options, receiver, thePastryNode |
Constructor Summary | |
---|---|
CommonAPIAppl(PastryNode pn)
Constructor. |
|
CommonAPIAppl(PastryNode pn,
java.lang.String instance)
Constructor. |
Method Summary | |
---|---|
abstract void |
deliver(Id key,
Message msg)
Called by pastry when a message arrives for this application. |
void |
forward(RouteMessage msg)
Called by pastry when a message is enroute and is passing through this node. |
void |
leafSetChange(NodeHandle nh,
boolean wasAdded)
Called by pastry when the leaf set changes. |
NodeSet |
localLookup(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(Message msg)
Called by pastry when a message arrives for this application. |
NodeSet |
neighborSet(int num)
This method produces an unordered list of nodehandles that are neighbors of the local node in the ID space. |
void |
notifyReady()
Invoked when the Pastry node has joined the overlay network and is ready to send and receive messages |
IdRange |
range(NodeHandle n,
int r,
Id key)
This method provides information about ranges of keys for which the node n is currently a r-root. |
IdRange |
range(NodeHandle n,
int r,
Id key,
boolean cumulative)
This method provides information about ranges of keys for which the node n is currently a r-root. |
void |
receiveMessage(Message msg)
Called by pastry to deliver a message to this client. |
NodeSet |
replicaSet(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(Id key,
Message msg,
NodeHandle hint)
This operation forwards a message towards the root of key. |
void |
update(NodeHandle nh,
boolean joined)
Called by pastry when the neighbor set changes. |
Methods inherited from class rice.pastry.client.PastryAppl |
---|
accept, canReceiveSocket, connect, deliverWhenNotReady, destroy, enrouteMessage, finishReceiveSocket, getAddress, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, 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 |
Constructor Detail |
---|
public CommonAPIAppl(PastryNode pn)
pn
- the pastry node that the application attaches to.public CommonAPIAppl(PastryNode pn, java.lang.String instance)
pn
- the pastry node that the application attaches to.Method Detail |
---|
public void route(Id key, Message msg, NodeHandle hint)
key
- the keymsg
- the message to deliver.hint
- the hintpublic NodeSet localLookup(Id key, int num, boolean safe)
key
- the message's keynum
- the maximal number of next hops nodes requestedsafe
-
public NodeSet neighborSet(int num)
num
- the maximal number of nodehandles requested
public NodeSet replicaSet(Id key, int max_rank)
key
- the keymax_rank
- the maximal number of nodehandles returned
public IdRange range(NodeHandle n, int r, 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 0 Returns:public IdRange range(NodeHandle n, int r, Id key)
n
- nodeHandle of the node whose range is being queriedr
- the rankkey
- the key
public abstract void deliver(Id key, Message msg)
msg
- the message that is arriving.public void forward(RouteMessage msg)
msg
- the message that is passing through.key
- the keynextHop
- the default next hop for the message.public void update(NodeHandle nh, boolean joined)
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 void notifyReady()
notifyReady
in class PastryAppl
public final void messageForAppl(Message msg)
PastryAppl
messageForAppl
in class PastryAppl
msg
- the message that is arriving.public final void leafSetChange(NodeHandle nh, boolean wasAdded)
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 void receiveMessage(Message msg)
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 |