|
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 Application |
application
DESCRIBE THE FIELD |
protected java.lang.String |
instance
DESCRIBE THE FIELD |
Fields inherited from class rice.pastry.client.PastryAppl |
address, deserializer, logger, receiver, thePastryNode |
Constructor Summary | |
PastryEndpoint(PastryNode pn,
Application application,
java.lang.String instance,
boolean register)
Constructor. |
|
PastryEndpoint(PastryNode pn,
Application application,
java.lang.String instance,
int address,
boolean register)
Constructor. |
Method Summary | |
NodeHandle |
coalesce(NodeHandle newHandle)
DESCRIBE THE METHOD |
void |
connect(NodeHandle handle,
AppSocketReceiver receiver,
int timeout)
Translate to a pastry.NodeHandle, otherwise, this is a passthrough function. |
boolean |
enrouteMessage(Message msg,
Id key,
NodeHandle nextHop,
SendOptions opt)
DESCRIBE THE METHOD |
MessageDeserializer |
getDeserializer()
Gets the Deserializer attribute of the PastryEndpoint object |
Environment |
getEnvironment()
Gets the Environment attribute of the PastryEndpoint object |
Id |
getId()
Returns this node's id, which is its identifier in the namespace. |
java.lang.String |
getInstance()
Returns a unique instance name of this endpoint, sort of a mailbox name for this application. |
NodeHandle |
getLocalNodeHandle()
Returns a handle to the local node below this endpoint. |
void |
leafSetChange(NodeHandle nh,
boolean wasAdded)
DESCRIBE THE METHOD |
NodeHandleSet |
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)
DESCRIBE THE METHOD |
NodeHandleSet |
neighborSet(int num)
This method produces an unordered list of nodehandles that are neighbors of the local node in the ID space. |
void |
process(Executable task,
Continuation command)
Schedules a job for processing on the dedicated processing thread. |
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. |
Id |
readId(InputBuffer buf,
short type)
DESCRIBE THE METHOD |
IdRange |
readIdRange(InputBuffer buf)
DESCRIBE THE METHOD |
NodeHandle |
readNodeHandle(InputBuffer buf)
DESCRIBE THE METHOD |
NodeHandleSet |
readNodeHandleSet(InputBuffer buf,
short type)
DESCRIBE THE METHOD |
void |
receiveMessage(Message msg)
Called by pastry to deliver a message to this client. |
NodeHandleSet |
replicaSet(Id id,
int maxRank)
This method returns an ordered set of nodehandles on which replicas of the object with key can be stored. |
NodeHandleSet |
replicaSet(Id id,
int maxRank,
NodeHandle root,
NodeHandleSet set)
This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored. |
void |
route(Id key,
Message msg,
NodeHandle hint)
This operation forwards a message towards the root of key. |
void |
route(Id key,
RawMessage msg,
NodeHandle hint)
DESCRIBE THE METHOD |
CancellableTask |
scheduleMessage(Message message,
long delay)
Schedules a message to be delivered to this application after the provided number of milliseconds. |
CancellableTask |
scheduleMessage(Message message,
long delay,
long period)
Schedules a message to be delivered to this application every period number of milliseconds, after delay number of miliseconds have passed. |
CancellableTask |
scheduleMessageAtFixedRate(Message msg,
long delay,
long period)
Schedule the specified message for repeated fixed-rate delivery to the local node, beginning after the specified delay. |
void |
setDeserializer(MessageDeserializer md)
Sets the Deserializer attribute of the PastryEndpoint object |
java.lang.String |
toString()
DESCRIBE THE METHOD |
Methods inherited from class rice.pastry.client.PastryAppl |
accept, connect, deliverWhenNotReady, destroy, enrouteMessage, getAddress, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, notifyReady, receiveMessageInternal, receiveSocket, register, routeMsg, routeMsgDirect, routeSetChange, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface rice.p2p.commonapi.Endpoint |
accept, register |
Field Detail |
protected Application application
protected java.lang.String instance
Constructor Detail |
public PastryEndpoint(PastryNode pn, Application application, java.lang.String instance, boolean register)
pn
- the pastry node that the application attaches to.application
- DESCRIBE THE PARAMETERinstance
- DESCRIBE THE PARAMETERregister
- DESCRIBE THE PARAMETERpublic PastryEndpoint(PastryNode pn, Application application, java.lang.String instance, int address, boolean register)
pn
- the pastry node that the application attaches to.application
- DESCRIBE THE PARAMETERinstance
- DESCRIBE THE PARAMETERaddress
- DESCRIBE THE PARAMETERregister
- DESCRIBE THE PARAMETERMethod Detail |
public Id getId()
getId
in interface Endpoint
public NodeHandle getLocalNodeHandle()
getLocalNodeHandle
in interface Endpoint
public java.lang.String getInstance()
getInstance
in interface Endpoint
public Environment getEnvironment()
getEnvironment
in interface Endpoint
public MessageDeserializer getDeserializer()
getDeserializer
in interface Endpoint
public void setDeserializer(MessageDeserializer md)
setDeserializer
in interface Endpoint
setDeserializer
in class PastryAppl
md
- The new Deserializer valuepublic void route(Id key, Message msg, NodeHandle hint)
route
in interface Endpoint
key
- the keymsg
- the message to deliver.hint
- the hintpublic void route(Id key, RawMessage msg, NodeHandle hint)
route
in interface Endpoint
key
- DESCRIBE THE PARAMETERmsg
- DESCRIBE THE PARAMETERhint
- DESCRIBE THE PARAMETERpublic CancellableTask scheduleMessage(Message message, long delay)
scheduleMessage
in interface Endpoint
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the
message
public CancellableTask scheduleMessage(Message message, long delay, long period)
scheduleMessage
in interface Endpoint
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the fist
messageperiod
- DESCRIBE THE PARAMETER
public CancellableTask scheduleMessageAtFixedRate(Message msg, long delay, long period)
scheduleMessageAtFixedRate
in interface Endpoint
msg
- a message that will be delivered to the local node after the
specified delaydelay
- time in milliseconds before message is to be deliveredperiod
- time in milliseconds between successive message deliveries
public NodeHandleSet localLookup(Id key, int num, boolean safe)
localLookup
in interface Endpoint
key
- the message's keynum
- the maximal number of next hops nodes requestedsafe
-
public NodeHandleSet neighborSet(int num)
neighborSet
in interface Endpoint
num
- the maximal number of nodehandles requested
public NodeHandleSet replicaSet(Id id, int maxRank)
replicaSet
in interface Endpoint
id
- DESCRIBE THE PARAMETERmaxRank
- DESCRIBE THE PARAMETER
public NodeHandleSet replicaSet(Id id, int maxRank, NodeHandle root, NodeHandleSet set)
replicaSet
in interface Endpoint
id
- The object's id.maxRank
- The number of desired replicas.set
- The set of other nodes around the root handleroot
- DESCRIBE THE PARAMETER
public IdRange range(NodeHandle n, int r, Id key, boolean cumulative)
range
in interface Endpoint
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 IdRange range(NodeHandle n, int r, Id key)
range
in interface Endpoint
n
- nodeHandle of the node whose range is being queriedr
- the rankkey
- the key
public final void messageForAppl(Message msg)
messageForAppl
in class PastryAppl
msg
- DESCRIBE THE PARAMETERpublic final boolean enrouteMessage(Message msg, Id key, NodeHandle nextHop, SendOptions opt)
msg
- DESCRIBE THE PARAMETERkey
- DESCRIBE THE PARAMETERnextHop
- DESCRIBE THE PARAMETERopt
- DESCRIBE THE PARAMETER
public void leafSetChange(NodeHandle nh, boolean wasAdded)
leafSetChange
in class PastryAppl
nh
- DESCRIBE THE PARAMETERwasAdded
- DESCRIBE THE PARAMETERpublic void receiveMessage(Message msg)
receiveMessage
in class PastryAppl
msg
- the message that is arriving.public void process(Executable task, Continuation command)
process
in interface Endpoint
task
- The task to run on the processing threadcommand
- The command to return the result to once it's donepublic void connect(NodeHandle handle, AppSocketReceiver receiver, int timeout)
connect
in interface Endpoint
handle
- DESCRIBE THE PARAMETERreceiver
- DESCRIBE THE PARAMETERtimeout
- DESCRIBE THE PARAMETERpublic java.lang.String toString()
public Id readId(InputBuffer buf, short type) throws java.io.IOException
readId
in interface Endpoint
buf
- DESCRIBE THE PARAMETERtype
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic NodeHandle readNodeHandle(InputBuffer buf) throws java.io.IOException
readNodeHandle
in interface NodeHandleReader
buf
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic IdRange readIdRange(InputBuffer buf) throws java.io.IOException
readIdRange
in interface Endpoint
buf
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic NodeHandle coalesce(NodeHandle newHandle)
coalesce
in interface NodeHandleReader
newHandle
- DESCRIBE THE PARAMETER
public NodeHandleSet readNodeHandleSet(InputBuffer buf, short type) throws java.io.IOException
readNodeHandleSet
in interface Endpoint
buf
- DESCRIBE THE PARAMETERtype
- 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 |