Rice Pastry API

rice.pastry.transport
Class TransportPastryNodeFactory

java.lang.Object
  extended by rice.pastry.PastryNodeFactory
      extended by rice.pastry.transport.TransportPastryNodeFactory
Direct Known Subclasses:
SocketPastryNodeFactory

public class TransportPastryNodeFactory
extends PastryNodeFactory


Field Summary
protected  int findFireWallPolicy
           
static byte[] PASTRY_MAGIC_NUMBER
           
protected  int testFireWallPolicy
           
 
Fields inherited from class rice.pastry.PastryNodeFactory
environment, logger, lSetSize, pingCache, rtBase, rtMax
 
Constructor Summary
TransportPastryNodeFactory(NodeIdFactory nf, java.net.InetAddress bindAddress, int startPort, Environment env, NATHandler handler)
          Constructor.
TransportPastryNodeFactory(NodeIdFactory nf, int startPort, Environment env)
           
 
Method Summary
 LeafSet getLeafSet(NodeHandle handle)
          This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion.
 CancellableTask getLeafSet(NodeHandle handle, Continuation c)
          Non-blocking version.
 int getProximity(NodeHandle local, NodeHandle handle)
          This method determines and returns the proximity of the current local node the provided NodeHandle.
 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.
 CancellableTask getRouteRow(NodeHandle handle, int row, Continuation c)
          Non-blocking version.
 PastryNode newNode(Id id)
           
 PastryNode newNode(Id nodeId, java.net.InetSocketAddress pAddress)
          Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)
 PastryNode newNode(Id nodeId, java.net.InetSocketAddress pAddress, boolean throwException)
           
 PastryNode newNode(NodeHandle bootstrap)
          Method which creates a Pastry node from the next port with a randomly generated NodeId.
 PastryNode newNode(NodeHandle bootstrap, Id nodeId)
          Call this to construct a new node of the type chosen by the factory, with the given nodeId.
 PastryNode newNode(NodeHandle bootstrap, Id nodeId, java.net.InetSocketAddress proxy)
          Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)
 PastryNode newNode(NodeHandle bootstrap, java.net.InetSocketAddress proxy)
          Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)
 
Methods inherited from class rice.pastry.PastryNodeFactory
getEnvironment, getNearest, newNode, proximity, sortedProximityCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASTRY_MAGIC_NUMBER

public static final byte[] PASTRY_MAGIC_NUMBER

testFireWallPolicy

protected int testFireWallPolicy

findFireWallPolicy

protected int findFireWallPolicy
Constructor Detail

TransportPastryNodeFactory

public TransportPastryNodeFactory(NodeIdFactory nf,
                                  java.net.InetAddress bindAddress,
                                  int startPort,
                                  Environment env,
                                  NATHandler handler)
                           throws java.io.IOException
Constructor. Here is order for bind address 1) bindAddress parameter 2) if bindAddress is null, then parameter: socket_bindAddress (if it exists) 3) if socket_bindAddress doesn't exist, then InetAddress.getLocalHost()

Parameters:
nf - The factory for building node ids
bindAddress - which address to bind to
startPort - The port to start creating nodes on
env - The environment.
Throws:
java.io.IOException

TransportPastryNodeFactory

public TransportPastryNodeFactory(NodeIdFactory nf,
                                  int startPort,
                                  Environment env)
                           throws java.io.IOException
Throws:
java.io.IOException
Method Detail

newNode

public PastryNode newNode(NodeHandle bootstrap)
Method which creates a Pastry node from the next port with a randomly generated NodeId.

Specified by:
newNode in class PastryNodeFactory
Parameters:
bootstrap - Node handle to bootstrap from.
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(NodeHandle bootstrap,
                          Id nodeId,
                          java.net.InetSocketAddress proxy)
Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)

Parameters:
bootstrap - Node handle to bootstrap from.
nodeId - if non-null, will use this nodeId for the node, rather than using the NodeIdFactory
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(NodeHandle bootstrap,
                          java.net.InetSocketAddress proxy)
Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)

Parameters:
bootstrap - Node handle to bootstrap from.
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(NodeHandle bootstrap,
                          Id nodeId)
Description copied from class: PastryNodeFactory
Call this to construct a new node of the type chosen by the factory, with the given nodeId.

Specified by:
newNode in class PastryNodeFactory
Parameters:
bootstrap - The node handle to bootstrap off of
nodeId - The nodeId of the new node

newNode

public PastryNode newNode(Id nodeId,
                          java.net.InetSocketAddress pAddress)
Method which creates a Pastry node from the next port with the specified nodeId (or one generated from the NodeIdFactory if not specified)

Parameters:
bootstrap - Node handle to bootstrap from.
nodeId - if non-null, will use this nodeId for the node, rather than using the NodeIdFactory
pAddress - The address to claim that this node is at - used for proxies behind NATs
Returns:
A node with a random ID and next port number.

newNode

public PastryNode newNode(Id id)
                   throws java.io.IOException
Specified by:
newNode in class PastryNodeFactory
Throws:
java.io.IOException

newNode

public PastryNode newNode(Id nodeId,
                          java.net.InetSocketAddress pAddress,
                          boolean throwException)
                   throws java.io.IOException
Throws:
java.io.IOException

getLeafSet

public LeafSet getLeafSet(NodeHandle handle)
                   throws java.io.IOException
Description copied from class: PastryNodeFactory
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.

Specified by:
getLeafSet in class PastryNodeFactory
Parameters:
handle - The node to connect to
Returns:
The leafset of the remote node
Throws:
java.io.IOException

getLeafSet

public CancellableTask getLeafSet(NodeHandle handle,
                                  Continuation c)
Description copied from class: PastryNodeFactory
Non-blocking version.

Specified by:
getLeafSet in class PastryNodeFactory
Returns:

getProximity

public int getProximity(NodeHandle local,
                        NodeHandle handle)
Description copied from class: PastryNodeFactory
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.

Specified by:
getProximity in class PastryNodeFactory
handle - The handle to determine the proximity of
Returns:
The proximity of the provided handle

getRouteRow

public RouteSet[] getRouteRow(NodeHandle handle,
                              int row)
                       throws java.io.IOException
Description copied from class: PastryNodeFactory
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.

Specified by:
getRouteRow in class PastryNodeFactory
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 CancellableTask getRouteRow(NodeHandle handle,
                                   int row,
                                   Continuation c)
Description copied from class: PastryNodeFactory
Non-blocking version.

Specified by:
getRouteRow in class PastryNodeFactory
Returns:

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection