Rice Pastry API

rice.p2p.commonapi
Interface Endpoint

All Known Implementing Classes:
PastryEndpoint

public interface Endpoint

Version:
$Id: Endpoint.java,v 1.5 2003/06/11 17:24:48 amislove Exp $
Author:
Alan Mislove, Peter Druschel

Method Summary
 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.
 rice.p2p.commonapi.NodeHandleSet localLookup(rice.p2p.commonapi.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.
 rice.p2p.commonapi.NodeHandleSet neighborSet(int num)
          This methods returns an unordered set of nodehandles on which are neighbors of the local node in the id space.
 rice.p2p.commonapi.IdRange range(rice.p2p.commonapi.NodeHandle handle, int rank, rice.p2p.commonapi.Id lkey)
          This operation provides information about ranges of keys for which the node is currently a rank-root.
 rice.p2p.commonapi.NodeHandleSet replicaSet(rice.p2p.commonapi.Id id, int maxRank)
          This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored.
 void route(rice.p2p.commonapi.Id id, rice.p2p.commonapi.Message message, rice.p2p.commonapi.NodeHandle hint)
          This method makes an attempt to route the message to the root of the given id.
 void scheduleMessage(rice.p2p.commonapi.Message message, long delay)
          Schedules a message to be delivered to this application after the provided number of milliseconds.
 

Method Detail

getId

public rice.p2p.commonapi.Id getId()
Returns this node's id, which is its identifier in the namespace.

Returns:
The local node's id

route

public void route(rice.p2p.commonapi.Id id,
                  rice.p2p.commonapi.Message message,
                  rice.p2p.commonapi.NodeHandle hint)
This method makes an attempt to route the message to the root of the given id. The hint handle will be the first hop in the route. If the id field is null, then the message is routed directly to the given node, and delivers the message there. If the hint field is null, then this method makes an attempt to route the message to the root of the given id. Note that one of the id and hint fields can be null, but not both.

Parameters:
id - The destination Id of the message.
message - The message to deliver

localLookup

public rice.p2p.commonapi.NodeHandleSet localLookup(rice.p2p.commonapi.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. If the safe flag is specified, then the fraction of faulty nodes returned is no higher than the fraction of faulty nodes in the overlay.

Parameters:
id - The destination id.
num - The number of nodes to return.
safe - Whether or not to return safe nodes.

neighborSet

public rice.p2p.commonapi.NodeHandleSet neighborSet(int num)
This methods returns an unordered set of nodehandles on which are neighbors of the local node in the id space. Up to num handles are returned.

Parameters:
num - The number of desired handle to return.

replicaSet

public rice.p2p.commonapi.NodeHandleSet replicaSet(rice.p2p.commonapi.Id id,
                                                   int maxRank)
This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored. The call returns nodes up to and including a node with maxRank.

Parameters:
id - The object's id.
maxRank - The number of desired replicas.

range

public rice.p2p.commonapi.IdRange range(rice.p2p.commonapi.NodeHandle handle,
                                        int rank,
                                        rice.p2p.commonapi.Id lkey)
This operation provides information about ranges of keys for which the node is currently a rank-root. The operations returns null if the range could not be determined, the range otherwise. It is an error to query the range of a node not present in the neighbor set as returned bythe update upcall or the neighborSet call. Certain implementations may return an error if rank is greater than zero. Some protocols may have multiple, disjoint ranges of keys for which a given node is responsible. The parameter lkey allows the caller to specify which region should be returned. If the node referenced by is responsible for key lkey, then the resulting range includes lkey. Otherwise, the result is the nearest range clockwise from lkey for which is responsible.

Parameters:
handle - The handle whose range to check.
rank - The root rank.
lkey - An "index" in case of multiple ranges.

getLocalNodeHandle

public rice.p2p.commonapi.NodeHandle getLocalNodeHandle()
Returns a handle to the local node below this endpoint. This node handle is serializable, and can therefore be sent to other nodes in the network and still be valid.

Returns:
A NodeHandle referring to the local node.

scheduleMessage

public void scheduleMessage(rice.p2p.commonapi.Message message,
                            long delay)
Schedules a message to be delivered to this application after the provided number of milliseconds.

Parameters:
message - The message to be delivered
delay - The number of milliseconds to wait before delivering the message

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection