Fairness.Trees
Class PastryTreeManager

java.lang.Object
  extended by Fairness.Trees.TreeManager
      extended by Fairness.Trees.PastryTreeManager

public class PastryTreeManager
extends TreeManager

PastryTreeManager implements the Pastry-style tree routing algorithm from the SplitStream paper. The algorithm is covered in detail in the paper analysis in the final report for the SplitStream.


Field Summary
 
Fields inherited from class Fairness.Trees.TreeManager
sim
 
Constructor Summary
PastryTreeManager()
           
 
Method Summary
 void addNode(Node node)
          Adds a Node to this TreeManager for it to manage and build into trees.
 void findParent(int stripeId, Node n)
          Finds the parent for the given node for a particular stripe identified by the stripeId.
 int getNextNodeId()
          Returns the next node ID using the node ID allocation algorithm from this TreeManager.
 java.util.Collection<Node> getRootNodes()
          After a tree reconstruction, returns the nodes that are the roots of their stripe trees.
 void orphanChild(Node n, Node justAdded, int stripeOrphanWants)
          Determines the orphan that will be rejected by n (could be justAdded) and then finds a new parent for this orphan for the stripe identified by the stripeOrphanWants id.
 void rebuildTree()
          A method to completely rebuild the Node tree given all nodes in the system.
 void searchSCG(Node orphan, int stripeId)
          This method finds a parent for orphan for the specified stripe by searching randomly in the "Spare Capacity Group" (this terminology is borrowed from the SplitStream implementation, but in this implementation, the Spare Capacity Group is nothing more than a Set of nodes having spare outbound bandwidth enough to handle one more child.
protected  void setUp()
          Called when the public setup method is called.
 
Methods inherited from class Fairness.Trees.TreeManager
forestToString, getAllNodes, setUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PastryTreeManager

public PastryTreeManager()
Method Detail

setUp

protected void setUp()
Description copied from class: TreeManager
Called when the public setup method is called. At this time, the sim parameter has been initialized, and getAllNodes also should be valid to call.

Overrides:
setUp in class TreeManager

getRootNodes

public java.util.Collection<Node> getRootNodes()
After a tree reconstruction, returns the nodes that are the roots of their stripe trees. It is assumed that the Node is the root of its primary stripe and of no other. That is, Node getParent( getStripeId() ) should return null.

Specified by:
getRootNodes in class TreeManager
Returns:
non-null Collection of 0 or more Node.

addNode

public void addNode(Node node)
Adds a Node to this TreeManager for it to manage and build into trees. This method exists just for extra error checking purposes.

Overrides:
addNode in class TreeManager
Parameters:
node - non-null Node that has an ID that came from getNextNodeId.

getNextNodeId

public int getNextNodeId()
Returns the next node ID using the node ID allocation algorithm from this TreeManager.

Specified by:
getNextNodeId in class TreeManager

rebuildTree

public void rebuildTree()
A method to completely rebuild the Node tree given all nodes in the system. The Pastry routing algorithm is used to form the parent-child relationships, and the Scribe group mechanisms are used to maintain the interior-node-disjoint property of the forest.

Specified by:
rebuildTree in class TreeManager

findParent

public void findParent(int stripeId,
                       Node n)
Finds the parent for the given node for a particular stripe identified by the stripeId.

Parameters:
n - non-null Node that has an ID that came from getNextNodeId.
stripeId - - the int id identifying the stripe the node is attempting to receive

orphanChild

public void orphanChild(Node n,
                        Node justAdded,
                        int stripeOrphanWants)
Determines the orphan that will be rejected by n (could be justAdded) and then finds a new parent for this orphan for the stripe identified by the stripeOrphanWants id.

Parameters:
n - non-null Node that has an ID that came from getNextNodeId.
justAdded - the Node that was just added as the child of n
stripeOrphanWants - the id of the stripe that the orphan needs

searchSCG

public void searchSCG(Node orphan,
                      int stripeId)
This method finds a parent for orphan for the specified stripe by searching randomly in the "Spare Capacity Group" (this terminology is borrowed from the SplitStream implementation, but in this implementation, the Spare Capacity Group is nothing more than a Set of nodes having spare outbound bandwidth enough to handle one more child.

Parameters:
orphan - the orphan who needs to receive the stripe identified by stripeId
stripeId - the integer id for the stripe that orphan needs