ePOST API

rice.p2p.multiring
Class MultiringNodeCollection

java.lang.Object
  extended by rice.p2p.multiring.MultiringNodeCollection

public class MultiringNodeCollection
extends java.lang.Object

Version:
$Id: MultiringNodeCollection.java 2587 2005-06-21 21:30:21Z jeffh $
Author:
Alan Mislove

Field Summary
 int BASE
          The routing base for ring ids, in bytes
protected  java.util.Vector nodes
          The list of nodes in the collection
 
Constructor Summary
MultiringNodeCollection(MultiringNode node, int BASE)
          Constructor
 
Method Summary
 void addNode(MultiringNode node)
          This method allows other nodes to be dynamically added to the node collection.
protected  void broadcastNewNode(MultiringNode node)
          This method informs all of the existing nodes of the newly added node, and informs the newly added node of all of the existing nodes.
protected  int getLength(RingId a)
          This method returns the length of the given ringId
protected  int getLengthOfSharedPrefix(RingId a, RingId b)
          This method returns the length of the shared prefix, in bytes, of the two provided ringIds by comparing the ring values.
protected  void route(RingId id, Message message, java.lang.String application)
          This method returns the best next-hop to a given target, using ring hopping, if one exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE

public int BASE
The routing base for ring ids, in bytes


nodes

protected java.util.Vector nodes
The list of nodes in the collection

Constructor Detail

MultiringNodeCollection

public MultiringNodeCollection(MultiringNode node,
                               int BASE)
Constructor

Parameters:
node - The node to base this node off of
Method Detail

addNode

public void addNode(MultiringNode node)
This method allows other nodes to be dynamically added to the node collection. Using this method, a node is added to the collection, and it is told of all of the other nodes in the collection. Similarly, all of the other nodes in the collection are told of this node.

Parameters:
node - The node to add to the collection

broadcastNewNode

protected void broadcastNewNode(MultiringNode node)
This method informs all of the existing nodes of the newly added node, and informs the newly added node of all of the existing nodes.

Parameters:
node - The node that is being added

route

protected void route(RingId id,
                     Message message,
                     java.lang.String application)
This method returns the best next-hop to a given target, using ring hopping, if one exists. Otherwise, if no local node in the collection is the next hop for the target, null is returned.

Parameters:
id - The target id of the message
message - The message to be sent
hint - A suggested hint

getLength

protected int getLength(RingId a)
This method returns the length of the given ringId

Parameters:
a - The ring Id
Returns:
The number of shared bytes

getLengthOfSharedPrefix

protected int getLengthOfSharedPrefix(RingId a,
                                      RingId b)
This method returns the length of the shared prefix, in bytes, of the two provided ringIds by comparing the ring values.

Parameters:
a - The first Id
b - The second Id
Returns:
The number of shared bytes

ePOST API

Copyright © 2001-2005 - Rice Pastry.