|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Endpoint
Method Summary | |
---|---|
void |
accept(AppSocketReceiver receiver)
Set's the acceptor for this application. |
void |
connect(NodeHandle handle,
AppSocketReceiver receiver,
int timeout)
Opens a connection to this application on a remote node. |
MessageDeserializer |
getDeserializer()
Returns the deserializer. |
Environment |
getEnvironment()
Returns the environment. |
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. |
NodeHandleSet |
localLookup(Id id,
int num,
boolean safe)
This call produces a list of nodes that can be used as next hops on a route towards the given id, such that the resulting route satisfies the overlay protocol's bounds on the number of hops taken. |
NodeHandleSet |
neighborSet(int num)
This methods returns an unordered set of nodehandles on which are neighbors of the local node in the id space. |
java.util.List |
networkNeighbors(int num)
Returns an ordered list of the nearest known neighbors. |
void |
process(Executable task,
Continuation command)
Schedules a job for processing on the dedicated processing thread. |
int |
proximity(NodeHandle nh)
This replaces NodeHandle.proximity(), so that you don't have to have a "coalesced" NodeHandle. |
IdRange |
range(NodeHandle handle,
int rank,
Id lkey)
This operation provides information about ranges of keys for which the node is currently a rank-root. |
IdRange |
range(NodeHandle handle,
int rank,
Id lkey,
boolean cumulative)
This operation provides information about ranges of keys for which the node is currently a rank-root. |
Id |
readId(InputBuffer buf,
short type)
To use a more efficient serialization format than Java Serialization |
IdRange |
readIdRange(InputBuffer buf)
To use Raw Serialization |
NodeHandleSet |
readNodeHandleSet(InputBuffer buf,
short type)
|
void |
register()
Call this after you have set up your Endpoint: called setDeserializer(), called accept(). |
NodeHandleSet |
replicaSet(Id id,
int maxRank)
This method returns an ordered set of nodehandles on which replicas of an object with a given id 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 id,
Message message,
NodeHandle hint)
This method makes an attempt to route the message to the root of the given id. |
void |
route(Id id,
RawMessage message,
NodeHandle hint)
Same as the other call, but uses the Raw serialization rather than java serialization. |
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 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. |
void |
setDeserializer(MessageDeserializer md)
To use a more efficient serialization format than Java Serialization |
Methods inherited from interface rice.p2p.commonapi.rawserialization.NodeHandleReader |
---|
coalesce, readNodeHandle |
Method Detail |
---|
Id getId()
void route(Id id, Message message, NodeHandle hint)
id
- The destination Id of the message.message
- The message to deliverhint
- The first node to send this message to, optionalvoid route(Id id, RawMessage message, NodeHandle hint)
id
- message
- hint
- NodeHandleSet localLookup(Id id, int num, boolean safe)
id
- The destination id.num
- The number of nodes to return.safe
- Whether or not to return safe nodes.NodeHandleSet neighborSet(int num)
num
- The number of desired handle to return.NodeHandleSet replicaSet(Id id, int maxRank)
id
- The object's id.maxRank
- The number of desired replicas.NodeHandleSet replicaSet(Id id, int maxRank, NodeHandle root, NodeHandleSet set)
id
- The object's id.maxRank
- The number of desired replicas.handle
- The root handle of the remove setset
- The set of other nodes around the root handleIdRange range(NodeHandle handle, int rank, Id lkey) throws RangeCannotBeDeterminedException
handle
- The handle whose range to check.rank
- The root rank.lkey
- An "index" in case of multiple ranges.
RangeCannotBeDeterminedException
IdRange range(NodeHandle handle, int rank, Id lkey, boolean cumulative) throws RangeCannotBeDeterminedException
handle
- The handle whose range to check.rank
- The root rank.lkey
- An "index" in case of multiple ranges.cumulative
- Whether to return the cumulative or single range
RangeCannotBeDeterminedException
NodeHandle getLocalNodeHandle()
CancellableTask scheduleMessage(Message message, long delay)
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the messageCancellableTask scheduleMessage(Message message, long delay, long period)
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the fist messagedelay
- The number of milliseconds to wait before delivering subsequent messagesCancellableTask scheduleMessageAtFixedRate(Message message, long delay, long period)
message
- The message to be delivereddelay
- The number of milliseconds to wait before delivering the fist messagedelay
- The number of milliseconds to wait before delivering subsequent messagesvoid process(Executable task, Continuation command)
task
- The task to run on the processing threadcommand
- The command to return the result to once it's donejava.lang.String getInstance()
Environment getEnvironment()
void accept(AppSocketReceiver receiver)
receiver
- calls receiveSocket() when a new AppSocket is opened to this application
from a remote node.
Note that you must call accept() again after each socket is received to properly handle
socket backloggingvoid connect(NodeHandle handle, AppSocketReceiver receiver, int timeout)
receiver
- calls receiveSocket() when a new AppSocket is opened to this application
on a remote node.void setDeserializer(MessageDeserializer md)
md
- MessageDeserializer getDeserializer()
Id readId(InputBuffer buf, short type) throws java.io.IOException
md
-
java.io.IOException
java.util.List networkNeighbors(int num)
num
-
IdRange readIdRange(InputBuffer buf) throws java.io.IOException
buf
-
java.io.IOException
NodeHandleSet readNodeHandleSet(InputBuffer buf, short type) throws java.io.IOException
java.io.IOException
void register()
int proximity(NodeHandle nh)
nh
-
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |