rice.pastry
Class PastryNodeFactory

java.lang.Object
  extended byrice.pastry.PastryNodeFactory
Direct Known Subclasses:
DirectPastryNodeFactory, DistPastryNodeFactory

public abstract class PastryNodeFactory
extends java.lang.Object

The interface to an object which can construct PastryNodes.


Constructor Summary
PastryNodeFactory()
           
 
Method Summary
abstract  LeafSet getLeafSet(NodeHandle handle)
          This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion.
 NodeHandle getNearest(NodeHandle local, NodeHandle seed)
          This method implements the algorithm in the Pastry locality paper for finding a close node the the current node through iterative leafset and route row requests.
abstract  int getProximity(NodeHandle local, NodeHandle handle)
          This method determines and returns the proximity of the current local node the provided NodeHandle.
abstract  RouteSet[] getRouteRow(NodeHandle handle, int row)
          This method returns the remote route row of the provided handle to the caller, in a protocol-dependent fashion.
abstract  PastryNode newNode(NodeHandle bootstrap)
          Call this to construct a new node of the type chosen by the factory.
abstract  PastryNode newNode(NodeHandle bootstrap, NodeId nodeId)
          Call this to construct a new node of the type chosen by the factory, with the given nodeId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PastryNodeFactory

public PastryNodeFactory()
Method Detail

newNode

public abstract PastryNode newNode(NodeHandle bootstrap)
Call this to construct a new node of the type chosen by the factory.

Parameters:
bootstrap - The node handle to bootstrap off of

newNode

public abstract PastryNode newNode(NodeHandle bootstrap,
                                   NodeId nodeId)
Call this to construct a new node of the type chosen by the factory, with the given nodeId.

Parameters:
bootstrap - The node handle to bootstrap off of
nodeId - The nodeId of the new node

getLeafSet

public abstract LeafSet getLeafSet(NodeHandle handle)
This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion. Note that this method may block while sending the message across the wire.

Parameters:
handle - The node to connect to
Returns:
The leafset of the remote node

getRouteRow

public abstract RouteSet[] getRouteRow(NodeHandle handle,
                                       int row)
This method returns the remote route row of the provided handle to the caller, in a protocol-dependent fashion. Note that this method may block while sending the message across the wire.

Parameters:
handle - The node to connect to
row - The row number to retrieve
Returns:
The route row of the remote node

getProximity

public abstract int getProximity(NodeHandle local,
                                 NodeHandle handle)
This method determines and returns the proximity of the current local node the provided NodeHandle. This will need to be done in a protocol- dependent fashion and may need to be done in a special way.

Parameters:
handle - The handle to determine the proximity of
Returns:
The proximity of the provided handle

getNearest

public NodeHandle getNearest(NodeHandle local,
                             NodeHandle seed)
This method implements the algorithm in the Pastry locality paper for finding a close node the the current node through iterative leafset and route row requests. The seed node provided is any node in the network which is a member of the pastry ring. This algorithm is designed to work in a protocol-independent manner, using the getResponse(Message) method provided by subclasses.

Parameters:
seed - Any member of the pastry ring
Returns:
A node suitable to boot off of (which is close the this node)





Imprint-Dataprotection