#include <TreeTopology.h>
Public Types | |
|
typedef std::map< NodeID, FountainWireProtPtr > | ChildNodeContainer |
| Shorthand for accessing child Fountain nodes. | |
| enum | { JOIN_TIMEOUT = 2, INCOMING_CONNECTION_TIMEOUT = 10, DEFAULT_CHILDREN_PER_NODE = 2 } |
| enum | TreeState |
| Contains all the states the tree topology can have. | |
Public Member Functions | |
| TreeTopology (const NodeID &ID) | |
| Creates a new TreeTopology object which is empty and in the idle state by default. | |
| ~TreeTopology () | |
| Destructor. | |
| TreeState | getState () const |
| Get the tree state. | |
| NodeID | getAvailableParentNode () const |
| bool | containsNode (const NodeID &node) |
| Check if the topology already contains a node with the specified ID. | |
| int | addNodeToTree (const NodeID &ID) |
| Add a Fountain node to the tree topology. | |
| void | handleLostChildRequest (ConstParseMsgPtr request, FountainWireProtPtr con) |
| Handle a lostChild request. | |
| void | handleLostParentRequest (ConstParseMsgPtr request, FountainWireProtPtr con) |
| Handle a lostParent request When a Fountain node in the tree topology loses one of its childConnections, it will connect to us and report the failure. This function is responsible for handling these requests. | |
| int | handleLostChild (const NodeID &childID) |
| Handles a lost child node of the Master Fountain node. | |
| bool | overRecoveryTimeLimit () |
| Check if we're over the recovery time limit. | |
| void | finishRebuilding () |
| Sets the tree back to idle if the tree state is rebuild and more than rebuildTimeLimit seconds have elapsed since the rebuild started. | |
| void | finishJoin () |
| Sets the tree back to idle if the tree state is join and more than joinTimeLimit seconds have elapsed since the last node joined the tree topology. | |
| int | recoverTree (ChildNodeContainer &masterNodeChildren) |
| Attempt to recover the tree from a node failure. | |
| void | rebuildTree (unsigned int degree=0) |
| Rebuilds the tree topology from scratch. | |
| void | addTreeTopology (BambooLib::XMLElement *treeTopologyXML) |
| Adds the current tree topology to an XMLElement. | |
| unsigned int | getTotalRecoveries () const |
| Get the total number of tree topology recoveries. | |
| unsigned int | getTotalRebuilds () const |
| Get the total number of tree topology rebuilds. | |
| double | getMaxRecoveryTime () const |
| Get the maximum time to recover the tree topology. | |
| double | getMinRecoveryTime () const |
| Get the minimum time to recover the tree topology. | |
| double | getAverageRecoveryTime () const |
| Get the average time to recover the tree topology. | |
Static Public Member Functions | |
| static const char * | fountain_convert (TreeState t) |
| Convert a TreeState into a c-string. | |
Private Types | |
| typedef std::list< TreeNode > | TreeContainer |
| foo | |
| typedef TreeContainer::iterator | treeIterator |
| makes it easier to use iterators for our tree container | |
| typedef TreeContainer::const_iterator | constTreeIterator |
| makes it easier to use const_iterators for our tree container | |
Private Member Functions | |
| bool | isReadyToRecover () |
| Test of all the neighboring nodes of a lost node have contacted the master Fountain node. | |
| int | replaceNode (const treeIterator &lostNode, const treeIterator &replacementNode) |
| Replaces a lost node in the tree with another node. | |
| unsigned int | getNumChildren (const constTreeIterator &node) const |
| Get the number of child nodes any node in the tree has. | |
| treeIterator | findNode (const NodeID &node) |
| Find a node in the tree topology based on its NodeID. | |
| treeIterator | getReplacementNode () |
| Get the replacement node from the tree. | |
| treeIterator | getParent (const NodeID &node) |
| Get the parent of a node in the tree based on its NodeID. | |
| treeIterator | getChild (const constTreeIterator &parent, unsigned int childNumber) |
| Get the child of a node in the tree based on the child's position relative to its parent. | |
| treeIterator | getLostNode () |
| Get the lost node of the tree topology. | |
| int | setState (TreeState s) |
| Set the state of the tree topology. | |
Private Attributes | |
| TreeContainer | tree_ |
| TreeState | state_ |
| Timer | recoveryTimer_ |
| Timer | rebuildTimer_ |
| Timer | joinTimer_ |
| NodeID | myID_ |
| unsigned int | totalRecoveries_ |
| double | maxRecoveryTime_ |
| double | minRecoveryTime_ |
| double | totalRecoveryTime_ |
| unsigned int | totalRebuilds_ |
| unsigned int | numChildrenPerNode_ |
Friends | |
| std::ostream & | operator<< (std::ostream &output, const TreeTopology &tree) |
| ostream operator | |
The TreeTopology class is used by the master Fountain daemon to maintain the tree structure of all the nodes and to recover from a node faialures
|
|
|
|
|
Creates a new TreeTopology object which is empty and in the idle state by default.
|
|
|
Add a Fountain node to the tree topology.
|
|
|
Adds the current tree topology to an XMLElement.
|
|
|
Check if the topology already contains a node with the specified ID.
|
|
|
Convert a TreeState into a c-string.
|
|
|
Brief Get the available parent node |
|
|
Get the average time to recover the tree topology.
|
|
||||||||||||
|
Get the child of a node in the tree based on the child's position relative to its parent.
|
|
|
Get the lost node of the tree topology.
|
|
|
Get the maximum time to recover the tree topology.
|
|
|
Get the minimum time to recover the tree topology.
|
|
|
Get the number of child nodes any node in the tree has.
|
|
|
Get the parent of a node in the tree based on its NodeID.
|
|
|
Get the replacement node from the tree.
|
|
|
Get the tree state.
|
|
|
Get the total number of tree topology rebuilds.
|
|
|
Get the total number of tree topology recoveries.
|
|
|
Handles a lost child node of the Master Fountain node.
|
|
||||||||||||
|
Handle a lostChild request. When a Fountain node in the tree topology loses its parentConnection it will connect to us and report the failure. This function is responsible for handling these requests.
|
|
||||||||||||
|
Handle a lostParent request When a Fountain node in the tree topology loses one of its childConnections, it will connect to us and report the failure. This function is responsible for handling these requests.
|
|
|
Test of all the neighboring nodes of a lost node have contacted the master Fountain node.
|
|
|
Check if we're over the recovery time limit.
|
|
|
Attempt to recover the tree from a node failure.
|
|
||||||||||||
|
Replaces a lost node in the tree with another node.
|
|
|
Set the state of the tree topology.
|
|
|
The starting time of the last node to join the tree |
|
|
Maximum recover time in milliseconds since the master Fountain node started |
|
|
Minimum recover time in milliseconds since the master Fountain node started |
|
|
NodeID of the master Fountain node |
|
|
The number of children for each node in the tree topology |
|
|
The starting time of rebuilding the tree |
|
|
The starting time of recovering from a node failure |
|
|
The current state of the tree make this a class so we can prevent the assignment operator from being used - sjm 9-30-2005 |
|
|
Total number of tree rebuilds |
|
|
Total number of tree recoveries since the master Fountain node started |
|
|
Total time of all recoveries in milliseconds since the master Fountain node started |
|
|
STL container to maintain all node in the tree topology |
1.4.6