Rice Pastry API

rice.p2p.multiring
Class MultiringEndpoint

java.lang.Object
  extended byrice.p2p.multiring.MultiringEndpoint
All Implemented Interfaces:
Endpoint

public class MultiringEndpoint
extends java.lang.Object
implements Endpoint

Version:
$Id: MultiringEndpoint.java,v 1.10 2005/06/30 22:22:24 jeffh Exp $
Author:
Alan Mislove

Field Summary
protected  Application application
          The application this endpoint is for
protected  Endpoint endpoint
          The node which this mulitring node is wrapping
protected  MultiringNode node
          The multiring node supporting this endpoint
 
Constructor Summary
protected MultiringEndpoint(MultiringNode node, Endpoint endpoint, Application application)
          Constructor
 
Method Summary
protected  void deliver(RingId id, Message target)
          Internal method which delivers the message to the application
 Environment getEnvironment()
          Gets the Environment attribute of the MultiringEndpoint 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.
 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.
 void process(Executable task, Continuation command)
          Schedules a job for processing on the dedicated processing thread.
 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.
 NodeHandleSet replicaSet(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.
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

node

protected MultiringNode node
The multiring node supporting this endpoint


application

protected Application application
The application this endpoint is for


endpoint

protected Endpoint endpoint
The node which this mulitring node is wrapping

Constructor Detail

MultiringEndpoint

protected MultiringEndpoint(MultiringNode node,
                            Endpoint endpoint,
                            Application application)
Constructor

Parameters:
node - The node to base this node off of
endpoint - DESCRIBE THE PARAMETER
application - DESCRIBE THE PARAMETER
Method Detail

getId

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

Specified by:
getId in interface Endpoint
Returns:
The local node's id

getLocalNodeHandle

public 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.

Specified by:
getLocalNodeHandle in interface Endpoint
Returns:
A NodeHandle referring to the local node.

getInstance

public java.lang.String getInstance()
Returns a unique instance name of this endpoint, sort of a mailbox name for this application.

Specified by:
getInstance in interface Endpoint
Returns:
The unique instance name of this application

getEnvironment

public Environment getEnvironment()
Gets the Environment attribute of the MultiringEndpoint object

Specified by:
getEnvironment in interface Endpoint
Returns:
The Environment value

route

public void route(Id id,
                  Message message,
                  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.

Specified by:
route in interface Endpoint
Parameters:
id - The destination Id of the message.
message - The message to deliver
hint - The first node to send this message to, optional

localLookup

public 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. 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.

Specified by:
localLookup in interface Endpoint
Parameters:
id - The destination id.
num - The number of nodes to return.
safe - Whether or not to return safe nodes.
Returns:
DESCRIBE THE RETURN VALUE

neighborSet

public 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.

Specified by:
neighborSet in interface Endpoint
Parameters:
num - The number of desired handle to return.
Returns:
DESCRIBE THE RETURN VALUE

replicaSet

public NodeHandleSet replicaSet(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.

Specified by:
replicaSet in interface Endpoint
Parameters:
id - The object's id.
maxRank - The number of desired replicas.
Returns:
DESCRIBE THE RETURN VALUE

replicaSet

public 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. The call returns nodes up to and including a node with maxRank. This call also allows the application to provide a remove "center" node, as well as other nodes in the vicinity.

Specified by:
replicaSet in interface Endpoint
Parameters:
id - The object's id.
maxRank - The number of desired replicas.
set - The set of other nodes around the root handle
root - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

range

public 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. 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.

Specified by:
range in interface Endpoint
Parameters:
handle - The handle whose range to check.
rank - The root rank.
lkey - An "index" in case of multiple ranges.
Returns:
DESCRIBE THE RETURN VALUE

range

public 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. 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.

Specified by:
range in interface Endpoint
Parameters:
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
Returns:
DESCRIBE THE RETURN VALUE

scheduleMessage

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

Specified by:
scheduleMessage in interface Endpoint
Parameters:
message - The message to be delivered
delay - The number of milliseconds to wait before delivering the message
Returns:
DESCRIBE THE RETURN VALUE

scheduleMessage

public 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.

Specified by:
scheduleMessage in interface Endpoint
Parameters:
message - The message to be delivered
delay - The number of milliseconds to wait before delivering the fist message
period - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

process

public void process(Executable task,
                    Continuation command)
Schedules a job for processing on the dedicated processing thread. CPU intensive jobs, such as encryption, erasure encoding, or bloom filter creation should never be done in the context of the underlying node's thread, and should only be done via this method.

Specified by:
process in interface Endpoint
Parameters:
task - The task to run on the processing thread
command - The command to return the result to once it's done

deliver

protected void deliver(RingId id,
                       Message target)
Internal method which delivers the message to the application

Parameters:
id - The target id
target - DESCRIBE THE PARAMETER

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection