#include <source/ariba/overlay/modules/chord/Chord.h>
Public Member Functions | |
Chord (BaseOverlay &_baseoverlay, const NodeID &_nodeid, OverlayStructureEvents *_eventsReceiver, const OverlayParameterSet ¶m) | |
virtual | ~Chord () |
virtual void | createOverlay () |
virtual void | deleteOverlay () |
virtual void | joinOverlay (const EndpointDescriptor &boot=EndpointDescriptor::UNSPECIFIED) |
virtual void | leaveOverlay () |
virtual const EndpointDescriptor & | resolveNode (const NodeID &node) |
virtual void | routeMessage (const NodeID &destnode, Message *msg) |
virtual NodeList | getKnownNodes () const |
virtual void | onLinkUp (const LinkID &lnk, const NodeID &remote) |
virtual void | onLinkDown (const LinkID &lnk, const NodeID &remote) |
virtual void | onMessage (const DataMessage &msg, const NodeID &remote, const LinkID &lnk=LinkID::UNSPECIFIED) |
virtual void | eventFunction () |
Private Member Functions | |
use_logging_h (Chord) | |
LinkID | setup (const EndpointDescriptor &endp) |
helper: sets up a link using the base overlay | |
seqnum_t | send (Message *msg, const LinkID &link) |
helper: sends a message using the "base overlay" | |
void | send_discovery_to (const NodeID &destination, int ttl=4) |
sends a discovery message | |
Private Attributes | |
chord_routing_table * | table |
int | orphan_removal_counter |
int | stabilize_counter |
int | stabilize_finger |
LinkID | bootstrapLink |
(1) The graph is bidirectional (2) Stabilization is done in a reactive manner
It therefore can be considered as a kind of Chorded-Kademlia :)
The resulting overlay graph has a diameter of O(log N).
Definition at line 71 of file Chord.h.
ariba::overlay::Chord::Chord | ( | BaseOverlay & | _baseoverlay, | |
const NodeID & | _nodeid, | |||
OverlayStructureEvents * | _eventsReceiver, | |||
const OverlayParameterSet & | param | |||
) |
Definition at line 54 of file Chord.cpp.
References bootstrapLink, orphan_removal_counter, stabilize_counter, stabilize_finger, table, and ariba::utility::LinkID::UNSPECIFIED.
ariba::overlay::Chord::~Chord | ( | ) | [virtual] |
ariba::overlay::Chord::use_logging_h | ( | Chord | ) | [private] |
LinkID ariba::overlay::Chord::setup | ( | const EndpointDescriptor & | endp | ) | [private] |
helper: sets up a link using the base overlay
Definition at line 73 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::overlay::BaseOverlay::establishLink(), logging_debug, ariba::overlay::OverlayInterface::OVERLAY_SERVICE_ID, and ariba::communication::EndpointDescriptor::toString().
Referenced by joinOverlay(), and onMessage().
helper: sends a message using the "base overlay"
Definition at line 81 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::utility::Identifier::isUnspecified(), and ariba::overlay::BaseOverlay::sendMessage().
Referenced by leaveOverlay(), onMessage(), and routeMessage().
void ariba::overlay::Chord::send_discovery_to | ( | const NodeID & | destination, | |
int | ttl = 4 | |||
) | [private] |
sends a discovery message
Definition at line 87 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::overlay::ChordMessage::discovery, ariba::overlay::BaseOverlay::getEndpointDescriptor(), logging_debug, ariba::overlay::OverlayInterface::nodeid, ariba::overlay::Discovery::normal, onMessage(), ariba::overlay::Discovery::setFollowType(), ariba::overlay::Discovery::setSourceEndpoint(), ariba::overlay::Discovery::setTTL(), ariba::utility::Identifier::toString(), ariba::utility::LinkID::UNSPECIFIED, and ariba::utility::NodeID::UNSPECIFIED.
Referenced by eventFunction(), and onLinkUp().
void ariba::overlay::Chord::createOverlay | ( | ) | [virtual] |
void ariba::overlay::Chord::deleteOverlay | ( | ) | [virtual] |
void ariba::overlay::Chord::joinOverlay | ( | const EndpointDescriptor & | boot = EndpointDescriptor::UNSPECIFIED |
) | [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 107 of file Chord.cpp.
References bootstrapLink, logging_info, ariba::utility::Timer::setInterval(), setup(), ariba::utility::Timer::start(), ariba::communication::EndpointDescriptor::toString(), and ariba::communication::EndpointDescriptor::UNSPECIFIED.
void ariba::overlay::Chord::leaveOverlay | ( | ) | [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 120 of file Chord.cpp.
References chord_routing_table::item::id, chord_routing_table::item::info, ariba::overlay::ChordMessage::leave, ariba::overlay::OverlayInterface::nodeid, send(), chord_routing_table::size(), ariba::utility::Timer::stop(), and table.
const EndpointDescriptor & ariba::overlay::Chord::resolveNode | ( | const NodeID & | node | ) | [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 129 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, chord_routing_table::get(), ariba::overlay::BaseOverlay::getEndpointDescriptor(), chord_routing_table::item::info, ariba::utility::Identifier::isUnspecified(), table, and ariba::communication::EndpointDescriptor::UNSPECIFIED.
Implements ariba::overlay::OverlayInterface.
Definition at line 135 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, chord_routing_table::get_next_hop(), chord_routing_table::item::id, ariba::overlay::BaseOverlay::incomingRouteMessage(), chord_routing_table::item::info, ariba::overlay::OverlayInterface::nodeid, ariba::overlay::ChordMessage::route, send(), and table.
OverlayInterface::NodeList ariba::overlay::Chord::getKnownNodes | ( | ) | const [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 148 of file Chord.cpp.
References chord_routing_table::size(), and table.
Reimplemented from ariba::overlay::OverlayInterface.
Definition at line 159 of file Chord.cpp.
References bootstrapLink, chord_routing_table::insert(), chord_routing_table::insert_orphan(), ariba::utility::Identifier::isUnspecified(), logging_debug, logging_info, ariba::overlay::OverlayInterface::nodeid, send_discovery_to(), table, ariba::utility::Identifier::toString(), and ariba::utility::LinkID::UNSPECIFIED.
Reimplemented from ariba::overlay::OverlayInterface.
Definition at line 182 of file Chord.cpp.
References chord_routing_table::get(), logging_debug, chord_routing_table::remove(), table, ariba::utility::Identifier::toString(), and ariba::utility::LinkID::UNSPECIFIED.
void ariba::overlay::Chord::onMessage | ( | const DataMessage & | msg, | |
const NodeID & | remote, | |||
const LinkID & | link = LinkID::UNSPECIFIED | |||
) | [virtual] |
Reimplemented from ariba::overlay::OverlayInterface.
Definition at line 194 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::overlay::BaseOverlay::dropLink(), chord_routing_table::get(), chord_routing_table::get_next_hop(), chord_routing_table::get_predesessor(), chord_routing_table::get_successor(), ariba::overlay::Discovery::getFollowType(), ariba::DataMessage::getMessage(), ariba::overlay::Discovery::getSourceEndpoint(), ariba::overlay::Discovery::getTTL(), chord_routing_table::item::id, ariba::overlay::BaseOverlay::incomingRouteMessage(), chord_routing_table::item::info, chord_routing_table::is_closest_to(), chord_routing_table::is_insertable(), logging_debug, ariba::overlay::OverlayInterface::nodeid, ariba::overlay::Discovery::normal, ariba::overlay::Discovery::predecessor, chord_routing_table::remove(), send(), ariba::overlay::Discovery::setFollowType(), ariba::overlay::Discovery::setTTL(), setup(), ariba::overlay::Discovery::successor, table, ariba::utility::Identifier::toString(), and ariba::utility::LinkID::UNSPECIFIED.
Referenced by send_discovery_to().
void ariba::overlay::Chord::eventFunction | ( | ) | [virtual] |
Reimplemented from ariba::utility::Timer.
Definition at line 328 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::overlay::BaseOverlay::dropLink(), chord_routing_table::get_finger_table(), chord_routing_table::get_finger_table_size(), chord_routing_table::get_predesessor(), chord_routing_table::get_successor(), chord_routing_table::item::id, chord_routing_table::item::info, ariba::utility::Identifier::isUnspecified(), logging_debug, logging_error, logging_info, ariba::overlay::OverlayInterface::nodeid, orphan_removal_counter, chord_routing_table::item::ref_count, send_discovery_to(), chord_routing_table::size(), stabilize_counter, stabilize_finger, table, ariba::utility::Identifier::toString(), and ariba::utility::LinkID::UNSPECIFIED.
chord_routing_table* ariba::overlay::Chord::table [private] |
Definition at line 74 of file Chord.h.
Referenced by Chord(), eventFunction(), getKnownNodes(), leaveOverlay(), onLinkDown(), onLinkUp(), onMessage(), resolveNode(), routeMessage(), and ~Chord().
int ariba::overlay::Chord::orphan_removal_counter [private] |
int ariba::overlay::Chord::stabilize_counter [private] |
int ariba::overlay::Chord::stabilize_finger [private] |
LinkID ariba::overlay::Chord::bootstrapLink [private] |