OverSim
|
PastryStateObject Module. More...
#include <PastryStateObject.h>
Public Member Functions | |
void | handleMessage (cMessage *msg) |
int | numInitStages (void) const |
void | initialize (int stage) |
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)=0 |
try to find a node numerically closer to a given key with the same shared prefix as the current node in the state table. | |
virtual void | findCloserNodes (const OverlayKey &destination, NodeVector *nodes)=0 |
virtual const TransportAddress & | failedNode (const TransportAddress &failed)=0 |
do something about a failed node | |
virtual const TransportAddress & | repair (const PastryStateMessage *msg, const PastryStateMsgProximity &prox) |
attempt to repair state using a received REPAIR message | |
virtual void | dumpToStateMessage (PastryStateMessage *msg) const =0 |
dump content of the set to a PastryStateMessage | |
virtual bool | mergeState (const PastryStateMessage *msg, const PastryStateMsgProximity *prox) |
update own state based on a received PastryStateMessage | |
virtual void | dumpToVector (std::vector< TransportAddress > &affected) const =0 |
append all entries to a given vector of TransportAddresses, needed to find all Nodes to be notified after joining. | |
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 |
Static Protected Member Functions | |
static const PastryExtendedNode & | unspecNode () |
Protected Attributes | |
NodeHandle | owner |
stores the NodeHandle of the owner of this PastryStateObject. | |
uint32_t | bitsPerDigit |
Private Member Functions | |
virtual void | earlyInit (void)=0 |
initialize watches etc. | |
virtual bool | mergeNode (const NodeHandle &node, simtime_t prox)=0 |
try to merge a single node in the state table | |
const OverlayKey * | keyDist (const OverlayKey &a, const OverlayKey &b) const |
compute the distance of two keys on the ring |
Static Private Attributes | |
static const PastryExtendedNode * | _unspecNode = NULL |
unspecified Node with proximity |
PastryStateObject Module.
This module class describes the common interface of all Pastry State Objects and implements what all have in common
Definition at line 48 of file PastryStateObject.h.
|
pure virtual |
dump content of the set to a PastryStateMessage
msg | the PastryStateMessage to be filled with entries |
Implemented in PastryLeafSet, PastryRoutingTable, and PastryNeighborhoodSet.
|
pure virtual |
append all entries to a given vector of TransportAddresses, needed to find all Nodes to be notified after joining.
affected | the vector to fill with entries |
Implemented in PastryRoutingTable, PastryLeafSet, and PastryNeighborhoodSet.
|
privatepure virtual |
initialize watches etc.
Referenced by initialize().
|
pure virtual |
do something about a failed node
failed | the failed node |
Implemented in PastryLeafSet, PastryRoutingTable, and PastryNeighborhoodSet.
|
pure virtual |
try to find a node numerically closer to a given key with the same shared prefix as the current node in the state table.
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 |
Implemented in PastryLeafSet, PastryRoutingTable, and PastryNeighborhoodSet.
|
pure virtual |
Implemented in PastryLeafSet, PastryRoutingTable, and PastryNeighborhoodSet.
|
virtual |
gets the final node according to the Pastry routing scheme.
destination | the destination key |
Reimplemented in PastryLeafSet.
Definition at line 53 of file PastryStateObject.cc.
void PastryStateObject::handleMessage | ( | cMessage * | msg | ) |
Definition at line 47 of file PastryStateObject.cc.
void PastryStateObject::initialize | ( | int | stage | ) |
Definition at line 39 of file PastryStateObject.cc.
bool PastryStateObject::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
test | the NodeHandle to test |
destination | the destination Key |
reference | NodeHandle to compare to, own node if unset |
Definition at line 146 of file PastryStateObject.cc.
Referenced by BasePastry::findNode(), PastryLeafSet::getDestinationNode(), PastryLeafSet::isClosestNode(), and specialCloserCondition().
|
private |
compute the distance of two keys on the ring
a | one key |
b | another key |
Definition at line 118 of file PastryStateObject.cc.
Referenced by isCloser().
|
privatepure virtual |
try to merge a single node in the state table
node | handle of the node |
prox | proximity value of the node |
Implemented in PastryRoutingTable, PastryLeafSet, and PastryNeighborhoodSet.
Referenced by mergeState().
|
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 in PastryLeafSet.
Definition at line 68 of file PastryStateObject.cc.
Referenced by Bamboo::checkProxCache(), Pastry::checkProxCache(), Pastry::handleStateMessage(), PastryRoutingTable::initStateFromHandleVector(), Pastry::mergeState(), and PastryRoutingTable::repair().
int PastryStateObject::numInitStages | ( | void | ) | const |
Definition at line 33 of file PastryStateObject.cc.
|
virtual |
attempt to repair state using a received REPAIR message
msg | the state message of type REPAIR |
prox | record of proximity values matching the state message |
Definition at line 60 of file PastryStateObject.cc.
bool PastryStateObject::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
This is needed for the "rare case" in the Pastry routing algorithm.
test | the NodeHandle to test |
destination | the destination Key |
reference | NodeHandle to compare to, own node if unset |
Definition at line 168 of file PastryStateObject.cc.
Referenced by PastryNeighborhoodSet::findCloserNode(), PastryRoutingTable::findCloserNode(), and PastryLeafSet::findCloserNode().
|
inlinestaticprotected |
Definition at line 175 of file PastryStateObject.h.
Referenced by PastryRoutingTable::addRow(), PastryNeighborhoodSet::failedNode(), PastryNeighborhoodSet::initializeSet(), and PastryRoutingTable::nodeAt().
|
staticprivate |
unspecified Node with proximity
Definition at line 172 of file PastryStateObject.h.
Referenced by unspecNode().
|
protected |
Definition at line 166 of file PastryStateObject.h.
Referenced by PastryRoutingTable::digitAt(), PastryRoutingTable::findCloserNode(), PastryNeighborhoodSet::initializeSet(), PastryLeafSet::initializeSet(), PastryRoutingTable::initializeTable(), PastryRoutingTable::lookupNextHop(), PastryRoutingTable::mergeNode(), and specialCloserCondition().
|
protected |
stores the NodeHandle of the owner of this PastryStateObject.
Derived classes have to initialize it.
Definition at line 164 of file PastryStateObject.h.
Referenced by PastryRoutingTable::addRow(), PastryLeafSet::createSiblingVector(), PastryLeafSet::estimateMeanDistance(), PastryRoutingTable::findCloserNode(), PastryRoutingTable::findNextNodeToAsk(), PastryLeafSet::getDestinationNode(), PastryNeighborhoodSet::initializeSet(), PastryLeafSet::initializeSet(), PastryRoutingTable::initializeTable(), isCloser(), PastryLeafSet::isClosestNode(), PastryRoutingTable::lookupNextHop(), PastryLeafSet::mergeNode(), PastryRoutingTable::mergeNode(), mergeState(), and specialCloserCondition().