Rice Pastry API

rice.pastry.wire
Class WirePastryNodeFactory

java.lang.Object
  |
  +--rice.pastry.PastryNodeFactory
        |
        +--rice.pastry.dist.DistPastryNodeFactory
              |
              +--rice.pastry.wire.WirePastryNodeFactory

public class WirePastryNodeFactory
extends DistPastryNodeFactory

Pastry node factory for Wire-linked nodes.

Version:
$Id: WirePastryNodeFactory.java,v 1.23 2003/10/01 06:35:10 amislove Exp $
Author:
Alan Mislove

Field Summary
 
Fields inherited from class rice.pastry.dist.DistPastryNodeFactory
PROTOCOL_RMI, PROTOCOL_WIRE
 
Constructor Summary
WirePastryNodeFactory(rice.pastry.NodeIdFactory nf, int startPort)
          Constructor.
 
Method Summary
 rice.pastry.NodeHandle generateNodeHandle(java.net.InetSocketAddress address)
          Method which contructs a node handle (using the wire protocol) for the node at address NodeHandle.
 rice.pastry.leafset.LeafSet getLeafSet(rice.pastry.NodeHandle handle)
          This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion.
 int getProximity(rice.pastry.NodeHandle local, rice.pastry.NodeHandle handle)
          This method determines and returns the proximity of the current local node the provided NodeHandle.
protected  rice.pastry.wire.messaging.socket.SocketCommandMessage getResponse(java.net.InetSocketAddress address, rice.pastry.wire.messaging.socket.SocketCommandMessage message)
          This method anonymously sends the given message to the remote address, blocks until a response is received, and then closes the socket and returns the response.
 rice.pastry.routing.RouteSet[] getRouteRow(rice.pastry.NodeHandle handle, int row)
          This method returns the remote route row of the provided handle to the caller, in a protocol-dependent fashion.
 rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap)
          Method which creates a Pastry node from the next port with a randomly generated NodeId.
 rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap, rice.pastry.NodeId nodeId)
          Method which creates a Pastry node from the next port with a randomly generated NodeId.
 
Methods inherited from class rice.pastry.dist.DistPastryNodeFactory
getFactory, getNodeHandle
 
Methods inherited from class rice.pastry.PastryNodeFactory
getNearest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WirePastryNodeFactory

public WirePastryNodeFactory(rice.pastry.NodeIdFactory nf,
                             int startPort)
Constructor.

Method Detail

generateNodeHandle

public rice.pastry.NodeHandle generateNodeHandle(java.net.InetSocketAddress address)
Method which contructs a node handle (using the wire protocol) for the node at address NodeHandle.

Specified by:
generateNodeHandle in class DistPastryNodeFactory
Parameters:
address - The address of the remote node.
Returns:
A NodeHandle cooresponding to that address

newNode

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

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

newNode

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

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

getLeafSet

public rice.pastry.leafset.LeafSet getLeafSet(rice.pastry.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.

Specified by:
getLeafSet in class PastryNodeFactory
Parameters:
handle - The node to connect to
Returns:
The leafset of the remote node

getRouteRow

public rice.pastry.routing.RouteSet[] getRouteRow(rice.pastry.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.

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

getProximity

public int getProximity(rice.pastry.NodeHandle local,
                        rice.pastry.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.

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

getResponse

protected rice.pastry.wire.messaging.socket.SocketCommandMessage getResponse(java.net.InetSocketAddress address,
                                                                             rice.pastry.wire.messaging.socket.SocketCommandMessage message)
                                                                      throws java.io.IOException
This method anonymously sends the given message to the remote address, blocks until a response is received, and then closes the socket and returns the response.

Parameters:
address - The address to send to
message - The message to send
Returns:
The response
java.io.IOException

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection