Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.pastry
Class PastryNodeFactory

    java.lang.Object
      rice.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 3507 2006-12-21 13:18:37Z jeffh $
Author:
  Andrew Ladd, Alan Mislove, Merziyah Poonawala, Abhishek Ray

Field Summary
`protected Environment` | `environment`
`protected Logger` | `logger`
`protected byte` | `lSetSize`
`protected java.util.Hashtable<NodeHandle,java.util.Hashtable<NodeHandle,java.lang.Integer>>` | `pingCache` Hashtable which keeps track of temporary ping values, which are only used during the getNearest() method
`protected byte` | `rtBase`
`protected byte` | `rtMax`

Constructor Summary
`PastryNodeFactory(Environment env)`

Method Summary
`Environment` | `getEnvironment()`
`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, Id nodeId)` Call this to construct a new node of the type chosen by the factory, with the given nodeId.
`protected int` | `proximity(NodeHandle local, NodeHandle handle)` Method which checks to see if we have a cached value of the remote ping, and if not, initiates a ping and then caches the value
`NodeHandle[]` | `sortedProximityCache(NodeHandle local)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### rtMax

    protected final byte rtMax

### lSetSize

    protected final byte lSetSize

### rtBase

    protected final byte rtBase

### pingCache

    protected java.util.Hashtable<NodeHandle,java.util.Hashtable<NodeHandle,java.lang.Integer>> pingCache

  Hashtable which keeps track of temporary ping values, which are only used during the getNearest() method

### environment

    protected Environment environment

### logger

    protected Logger logger

Constructor Detail

### PastryNodeFactory

    public PastryNodeFactory(Environment env)

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,
                                       Id 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)
                                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`

### 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`

### 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
  Returns:
    The proximity of the provided handle

### getEnvironment

    public Environment getEnvironment()

### proximity

    protected int proximity(NodeHandle local,
                            NodeHandle handle)

  Method which checks to see if we have a cached value of the remote ping, and if not, initiates a ping and then caches the value

  Parameters:
    `handle` - The handle to ping
  Returns:
    The proximity of the handle

### sortedProximityCache

    public NodeHandle[] sortedProximityCache(NodeHandle local)

### 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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.