|
OverSim
|
PastryLeafSet module. More...
#include <PastryLeafSet.h>
Public Member Functions | |
| void | initializeSet (uint32_t numberOfLeaves, uint32_t bitsPerDigit, simtime_t repairTimeout, const NodeHandle &owner, BasePastry *overlay) |
| Initializes the leaf set. | |
| virtual const NodeHandle & | getDestinationNode (const OverlayKey &destination) |
| gets the final node according to the Pastry routing scheme. | |
| virtual const NodeHandle & | findCloserNode (const OverlayKey &destination, bool optimize=false) |
| try to find a node numerically closer to a given key with the same shared prefix as the current node in the leaf set. | |
| void | findCloserNodes (const OverlayKey &destination, NodeVector *nodes) |
| virtual const TransportAddress & | failedNode (const TransportAddress &failed) |
| tells the leafset that a node has failed | |
| virtual const TransportAddress & | repair (const PastryStateMessage *msg, const PastryStateMsgProximity *prox) |
| attempt to repair the leafset using a received REPAIR message | |
| bool | isClosestNode (const OverlayKey &destination) const |
| checks if we are the closest node to key destination in the overlay | |
| virtual void | dumpToStateMessage (PastryStateMessage *msg) const |
| dump content of the set to a PastryStateMessage | |
| virtual const TransportAddress & | getRandomNode () |
| returns a random node from the leafset | |
| bool | mergeNode (const NodeHandle &node, simtime_t prox) |
| merge a node into LeafSet | |
| virtual bool | mergeState (const PastryStateMessage *msg, const PastryStateMsgProximity *prox) |
| update own state based on a received PastryStateMessage | |
| const NodeHandle & | getPredecessor (void) const |
| return predecessor node for visualizing | |
| const NodeHandle & | getSuccessor (void) const |
| return successor node for visualizing | |
| bool | isValid (void) const |
| check if LeafSet knows at least one node to the left and to the right | |
| virtual void | dumpToVector (std::vector< TransportAddress > &affected) const |
| appends all leaf set entries to a given vector of TransportAddresses, needed to find all Nodes to be notified after joining. | |
| NodeVector * | createSiblingVector (const OverlayKey &key, int numSiblings) const |
| PastryNewLeafsMessage * | getNewLeafsMessage (void) |
| generates a newLeafs-message if LeafSet changed since last call to this method. | |
| OverlayKey | estimateMeanDistance () |
Public Member Functions inherited from PastryStateObject | |
| void | handleMessage (cMessage *msg) |
| int | numInitStages (void) const |
| void | initialize (int stage) |
| virtual const TransportAddress & | repair (const PastryStateMessage *msg, const PastryStateMsgProximity &prox) |
| attempt to repair state using a received REPAIR message | |
| bool | isCloser (const NodeHandle &test, const OverlayKey &destination, const NodeHandle &reference=NodeHandle::UNSPECIFIED_NODE) const |
| test a given NodeHandle if it is closer to a given destination | |
| bool | specialCloserCondition (const NodeHandle &test, const OverlayKey &destination, const NodeHandle &reference=NodeHandle::UNSPECIFIED_NODE) const |
| test a given NodeHandle if it is closer to a given destination, but only if the shared prefix length with the destination is at least equal to the shared prefix length with our own node | |
Private Member Functions | |
| virtual void | earlyInit (void) |
| const NodeHandle & | getBiggestNode (void) const |
| return the node with the biggest key in the LeafSet or NodeHandle::UNSPECIFIED_NODE if LeafSet is empty | |
| const OverlayKey & | getBiggestKey (void) const |
| return the biggest key in the LeafSet or OverlayKey::UNSPECIFIED_KEY if LeafSet is empty | |
| const NodeHandle & | getSmallestNode (void) const |
| return the node with the smallest key in the LeafSet or NodeHandle::UNSPECIFIED_NODE if LeafSet is empty | |
| const OverlayKey & | getSmallestKey (void) const |
| return the smallest key in the LeafSet or OverlayKey::UNSPECIFIED_KEY if LeafSet is empty | |
| bool | isLeft (const OverlayKey &key) const |
| test if a given key should be placed on the left or on the right side of the leaf set | |
| void | insertLeaf (std::vector< NodeHandle >::iterator &it, const NodeHandle &node) |
| insert a leaf at a given position | |
| bool | balanceLeafSet () |
Private Attributes | |
| uint32_t | numberOfLeaves |
| simtime_t | repairTimeout |
| BasePastry * | overlay |
| pointer to the main pastry module | |
| std::vector< NodeHandle > | leaves |
| std::vector< NodeHandle >::iterator | smaller |
| std::vector< NodeHandle >::iterator | bigger |
| std::map< TransportAddress, PLSRepairData > | awaitingRepair |
| bool | newLeafs |
| bool | isFull |
| bool | wasFull |
Additional Inherited Members | |
Static Protected Member Functions inherited from PastryStateObject | |
| static const PastryExtendedNode & | unspecNode () |
Protected Attributes inherited from PastryStateObject | |
| NodeHandle | owner |
| stores the NodeHandle of the owner of this PastryStateObject. | |
| uint32_t | bitsPerDigit |
PastryLeafSet module.
This module contains the LeafSet of the Pastry implementation.
Definition at line 60 of file PastryLeafSet.h.
|
private |
Definition at line 407 of file PastryLeafSet.cc.
Referenced by failedNode(), and insertLeaf().
| NodeVector * PastryLeafSet::createSiblingVector | ( | const OverlayKey & | key, |
| int | numSiblings | ||
| ) | const |
Definition at line 212 of file PastryLeafSet.cc.
Referenced by BasePastry::findNode(), and BasePastry::isSiblingFor().
|
virtual |
dump content of the set to a PastryStateMessage
| msg | the PastryStateMessage to be filled with entries |
Implements PastryStateObject.
Definition at line 171 of file PastryLeafSet.cc.
Referenced by BasePastry::createStateMessage().
|
virtual |
appends all leaf set entries to a given vector of TransportAddresses, needed to find all Nodes to be notified after joining.
| affected | the vector to fill with leaf set entries |
Implements PastryStateObject.
Definition at line 441 of file PastryLeafSet.cc.
Referenced by Pastry::changeState(), and BasePastry::getLeafSet().
|
privatevirtual |
Definition at line 55 of file PastryLeafSet.cc.
| OverlayKey PastryLeafSet::estimateMeanDistance | ( | ) |
Definition at line 645 of file PastryLeafSet.cc.
Referenced by BasePastry::estimateMeanDistance().
|
virtual |
tells the leafset that a node has failed
| failed | the failed node |
Implements PastryStateObject.
Definition at line 521 of file PastryLeafSet.cc.
Referenced by Bamboo::handleFailedNode(), and Pastry::handleFailedNode().
|
virtual |
try to find a node numerically closer to a given key with the same shared prefix as the current node in the leaf set.
this method is to be called, when a regular next hop couldn't be found or wasn't reachable.
| destination | the destination key |
| optimize | if set, check all nodes and return the best/closest one |
Implements PastryStateObject.
Definition at line 492 of file PastryLeafSet.cc.
Referenced by BasePastry::findNode().
|
virtual |
Implements PastryStateObject.
Definition at line 481 of file PastryLeafSet.cc.
Referenced by BasePastry::findNode().
|
private |
return the biggest key in the LeafSet or OverlayKey::UNSPECIFIED_KEY if LeafSet is empty
Definition at line 475 of file PastryLeafSet.cc.
Referenced by createSiblingVector(), and getDestinationNode().
|
private |
return the node with the biggest key in the LeafSet or NodeHandle::UNSPECIFIED_NODE if LeafSet is empty
Definition at line 466 of file PastryLeafSet.cc.
Referenced by failedNode(), findCloserNode(), getBiggestKey(), and repair().
|
virtual |
gets the final node according to the Pastry routing scheme.
| destination | the destination key |
Reimplemented from PastryStateObject.
Definition at line 113 of file PastryLeafSet.cc.
Referenced by BasePastry::findNode().
| PastryNewLeafsMessage * PastryLeafSet::getNewLeafsMessage | ( | void | ) |
generates a newLeafs-message if LeafSet changed since last call to this method.
Definition at line 625 of file PastryLeafSet.cc.
Referenced by BasePastry::newLeafs().
| const NodeHandle & PastryLeafSet::getPredecessor | ( | void | ) | const |
return predecessor node for visualizing
Definition at line 101 of file PastryLeafSet.cc.
Referenced by BasePastry::updateTooltip().
|
virtual |
returns a random node from the leafset
Definition at line 188 of file PastryLeafSet.cc.
Referenced by Bamboo::doLeafsetMaintenance().
|
private |
return the smallest key in the LeafSet or OverlayKey::UNSPECIFIED_KEY if LeafSet is empty
Definition at line 460 of file PastryLeafSet.cc.
Referenced by createSiblingVector(), and getDestinationNode().
|
private |
return the node with the smallest key in the LeafSet or NodeHandle::UNSPECIFIED_NODE if LeafSet is empty
Definition at line 451 of file PastryLeafSet.cc.
Referenced by failedNode(), findCloserNode(), getSmallestKey(), and repair().
| const NodeHandle & PastryLeafSet::getSuccessor | ( | void | ) | const |
return successor node for visualizing
Definition at line 95 of file PastryLeafSet.cc.
Referenced by BasePastry::updateTooltip().
| void PastryLeafSet::initializeSet | ( | uint32_t | numberOfLeaves, |
| uint32_t | bitsPerDigit, | ||
| simtime_t | repairTimeout, | ||
| const NodeHandle & | owner, | ||
| BasePastry * | overlay | ||
| ) |
Initializes the leaf set.
This should be called on startup
| numberOfLeaves | Pastry configuration parameter |
| bitsPerDigit | number of bits per digits |
| repairTimeout | Pastry configuration parameter |
| owner | the node this table belongs to |
| overlay | pointer to the pastry main module |
Definition at line 61 of file PastryLeafSet.cc.
Referenced by BasePastry::baseChangeState().
|
private |
insert a leaf at a given position
| it | iterator where to insert the new leaf |
| node | NodeHandle of new leaf |
Definition at line 323 of file PastryLeafSet.cc.
Referenced by mergeNode().
| bool PastryLeafSet::isClosestNode | ( | const OverlayKey & | destination | ) | const |
checks if we are the closest node to key destination in the overlay
| destination | the key to check |
Definition at line 143 of file PastryLeafSet.cc.
Referenced by BasePastry::findNode(), and BasePastry::isSiblingFor().
|
private |
test if a given key should be placed on the left or on the right side of the leaf set
| key | key to test |
| bool PastryLeafSet::isValid | ( | void | ) | const |
check if LeafSet knows at least one node to the left and to the right
Definition at line 107 of file PastryLeafSet.cc.
Referenced by createSiblingVector(), Pastry::doSecondStage(), Bamboo::handleFailedNode(), and Pastry::handleFailedNode().
|
virtual |
merge a node into LeafSet
| node | the node to merge |
| prox | the proximity value of the node |
Implements PastryStateObject.
Definition at line 254 of file PastryLeafSet.cc.
|
virtual |
update own state based on a received PastryStateMessage
| msg | the PastryStateMessage to use as source for update |
| prox | record of proximity values matching the state message |
Reimplemented from PastryStateObject.
Definition at line 680 of file PastryLeafSet.cc.
Referenced by Pastry::handleStateMessage(), Bamboo::handleStateMessage(), Pastry::mergeState(), and repair().
|
virtual |
attempt to repair the leafset using a received REPAIR message
| msg | the state message of type REPAIR |
| prox | record of proximity values matching the state message |
Definition at line 573 of file PastryLeafSet.cc.
Referenced by Pastry::handleStateMessage().
|
private |
Definition at line 201 of file PastryLeafSet.h.
Referenced by failedNode(), initializeSet(), and repair().
|
private |
Definition at line 199 of file PastryLeafSet.h.
Referenced by balanceLeafSet(), failedNode(), getBiggestNode(), getSuccessor(), initializeSet(), insertLeaf(), isClosestNode(), isValid(), and mergeNode().
|
private |
Definition at line 205 of file PastryLeafSet.h.
Referenced by balanceLeafSet(), failedNode(), initializeSet(), insertLeaf(), mergeNode(), and repair().
|
private |
Definition at line 197 of file PastryLeafSet.h.
Referenced by balanceLeafSet(), createSiblingVector(), dumpToStateMessage(), dumpToVector(), earlyInit(), estimateMeanDistance(), failedNode(), findCloserNodes(), getBiggestNode(), getDestinationNode(), getNewLeafsMessage(), getRandomNode(), getSmallestNode(), initializeSet(), insertLeaf(), mergeNode(), and mergeState().
|
private |
Definition at line 203 of file PastryLeafSet.h.
Referenced by failedNode(), getNewLeafsMessage(), initializeSet(), and insertLeaf().
|
private |
Definition at line 194 of file PastryLeafSet.h.
Referenced by dumpToStateMessage(), failedNode(), getNewLeafsMessage(), getRandomNode(), initializeSet(), and insertLeaf().
|
private |
pointer to the main pastry module
Definition at line 196 of file PastryLeafSet.h.
Referenced by failedNode(), getBiggestNode(), getSmallestNode(), initializeSet(), insertLeaf(), mergeNode(), and mergeState().
|
private |
Definition at line 195 of file PastryLeafSet.h.
Referenced by initializeSet(), and repair().
|
private |
Definition at line 198 of file PastryLeafSet.h.
Referenced by balanceLeafSet(), failedNode(), getPredecessor(), getSmallestNode(), initializeSet(), insertLeaf(), isClosestNode(), isValid(), and mergeNode().
|
private |
Definition at line 206 of file PastryLeafSet.h.
Referenced by failedNode(), initializeSet(), and repair().