Rice Pastry API

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.

Version:
$Id: PastryNodeFactory.java 2834 2005-12-13 14:14:38Z jeffh $
Author:
Andrew Ladd, Alan Mislove, Merziyah Poonawala, Abhishek Ray

Field Summary
protected  Environment environment
          DESCRIBE THE FIELD
protected  Logger logger
          DESCRIBE THE FIELD
protected  int lSetSize
          DESCRIBE THE FIELD
protected  int rtBase
          DESCRIBE THE FIELD
protected  int rtMax
          DESCRIBE THE FIELD
 
Constructor Summary
PastryNodeFactory(Environment env)
          Constructor for PastryNodeFactory.
 
Method Summary
 Environment getEnvironment()
          Gets the Environment attribute of the PastryNodeFactory object
abstract  LeafSet getLeafSet(NodeHandle handle)
          This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion.
abstract  CancellableTask getLeafSet(NodeHandle handle, Continuation c)
          Non-blocking version.
 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  CancellableTask getRouteRow(NodeHandle handle, int row, Continuation c)
          Non-blocking version.
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
 

Field Detail

rtMax

protected final int rtMax
DESCRIBE THE FIELD


lSetSize

protected final int lSetSize
DESCRIBE THE FIELD


rtBase

protected final int rtBase
DESCRIBE THE FIELD


environment

protected Environment environment
DESCRIBE THE FIELD


logger

protected Logger logger
DESCRIBE THE FIELD

Constructor Detail

PastryNodeFactory

public PastryNodeFactory(Environment env)
Constructor for PastryNodeFactory.

Parameters:
env - DESCRIBE THE PARAMETER
Method Detail

getLeafSet

public abstract LeafSet getLeafSet(NodeHandle handle)
                            throws java.io.IOException
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
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

getLeafSet

public abstract CancellableTask getLeafSet(NodeHandle handle,
                                           Continuation c)
Non-blocking version.

Parameters:
handle -
c -
Returns:
Throws:
java.io.IOException

getRouteRow

public abstract RouteSet[] getRouteRow(NodeHandle handle,
                                       int row)
                                throws java.io.IOException
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
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

getRouteRow

public abstract CancellableTask getRouteRow(NodeHandle handle,
                                            int row,
                                            Continuation c)
Non-blocking version.

Parameters:
handle -
row -
c -
Returns:
Throws:
java.io.IOException

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
local - DESCRIBE THE PARAMETER
Returns:
The proximity of the provided handle

getEnvironment

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

Returns:
The Environment value

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
local - DESCRIBE THE PARAMETER
Returns:
A node suitable to boot off of (which is close the this node)

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
Returns:
DESCRIBE THE RETURN VALUE

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
Returns:
DESCRIBE THE RETURN VALUE

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection