#include <source/ariba/overlay/modules/chord/Chord.h>
Inherits ariba::overlay::OverlayInterface, and ariba::utility::Timer.
Public Member Functions | |
Chord (BaseOverlay &_baseoverlay, const NodeID &_nodeid, OverlayStructureEvents *_eventsReceiver, const OverlayParameterSet ¶m) | |
virtual | ~Chord () |
virtual const LinkID & | getNextLinkId (const NodeID &id) const |
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 NodeList | getKnownNodes (bool deep=true) 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, const NodeID &node=NodeID::UNSPECIFIED) |
helper: sets up a link using the base overlay | |
seqnum_t | send (OverlayMsg *msg, const LinkID &link) |
helper: sends a message using the "base overlay" | |
void | send_discovery_to (const NodeID &destination, int ttl=3) |
sends a discovery message | |
void | discover_neighbors (const LinkID &lnk) |
void | showLinks () |
Private Attributes | |
chord_routing_table * | table |
int | orphan_removal_counter |
int | stabilize_counter |
int | stabilize_finger |
vector< LinkID > | bootstrapLinks |
vector< NodeID > | pending |
vector< NodeID > | discovery |
int | discovery_count |
(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 73 of file Chord.h.
ariba::overlay::Chord::Chord | ( | BaseOverlay & | _baseoverlay, | |
const NodeID & | _nodeid, | |||
OverlayStructureEvents * | _eventsReceiver, | |||
const OverlayParameterSet & | param | |||
) |
Definition at line 59 of file Chord.cpp.
References discovery_count, orphan_removal_counter, stabilize_counter, stabilize_finger, and table.
ariba::overlay::Chord::~Chord | ( | ) | [virtual] |
void ariba::overlay::Chord::createOverlay | ( | ) | [virtual] |
void ariba::overlay::Chord::deleteOverlay | ( | ) | [virtual] |
void ariba::overlay::Chord::discover_neighbors | ( | const LinkID & | lnk | ) | [private] |
Definition at line 125 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::overlay::BaseOverlay::getEndpointDescriptor(), ariba::overlay::Discovery::predecessor, send(), ariba::overlay::OverlayMsg::setRegisterRelay(), ariba::overlay::OverlayMsg::setSourceEndpoint(), ariba::overlay::Discovery::successor, and ariba::overlay::typeDiscovery.
Referenced by eventFunction().
void ariba::overlay::Chord::eventFunction | ( | ) | [virtual] |
Reimplemented from ariba::utility::Timer.
Definition at line 401 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, discover_neighbors(), discovery, ariba::overlay::BaseOverlay::dropLink(), chord_routing_table::get_finger_table(), chord_routing_table::get_finger_table_size(), chord_routing_table::chord_routing_table::item::id, chord_routing_table::chord_routing_table::item::info, chord_routing_table::insert(), ariba::utility::Identifier::isUnspecified(), logging_debug, logging_info, ariba::overlay::OverlayInterface::nodeid, orphan_removal_counter, pending, chord_routing_table::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.
OverlayInterface::NodeList ariba::overlay::Chord::getKnownNodes | ( | bool | deep = true |
) | const [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 198 of file Chord.cpp.
References chord_routing_table::get_predesessor(), chord_routing_table::get_successor(), chord_routing_table::size(), and table.
return routing info
Implements ariba::overlay::OverlayInterface.
Definition at line 186 of file Chord.cpp.
References chord_routing_table::get_next_hop(), chord_routing_table::chord_routing_table::item::id, chord_routing_table::chord_routing_table::item::info, ariba::overlay::OverlayInterface::nodeid, table, and ariba::utility::LinkID::UNSPECIFIED.
Referenced by send_discovery_to().
void ariba::overlay::Chord::joinOverlay | ( | const EndpointDescriptor & | boot = EndpointDescriptor::UNSPECIFIED() |
) | [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 156 of file Chord.cpp.
References bootstrapLinks, ariba::communication::EndpointDescriptor::isUnspecified(), logging_info, ariba::utility::Timer::setInterval(), setup(), ariba::utility::Timer::start(), and ariba::communication::EndpointDescriptor::toString().
void ariba::overlay::Chord::leaveOverlay | ( | ) | [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 169 of file Chord.cpp.
References chord_routing_table::chord_routing_table::item::info, send(), chord_routing_table::size(), ariba::utility::Timer::stop(), table, and ariba::overlay::typeLeave.
Reimplemented from ariba::overlay::OverlayInterface.
Definition at line 265 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.
Reimplemented from ariba::overlay::OverlayInterface.
Definition at line 226 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, bootstrapLinks, ariba::overlay::BaseOverlay::dropLink(), chord_routing_table::chord_routing_table::item::info, chord_routing_table::insert(), chord_routing_table::insert_orphan(), ariba::utility::Identifier::isUnspecified(), logging_info, ariba::overlay::OverlayInterface::nodeid, pending, showLinks(), table, and ariba::utility::Identifier::toString().
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 279 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, discovery, ariba::overlay::BaseOverlay::dropLink(), chord_routing_table::get(), chord_routing_table::get_predesessor(), chord_routing_table::get_successor(), ariba::overlay::OverlayMsg::getDestinationNode(), ariba::overlay::Discovery::getEndpoint(), ariba::DataMessage::getMessage(), ariba::overlay::OverlayMsg::getSourceNode(), ariba::overlay::Discovery::getTTL(), ariba::overlay::Discovery::getType(), ariba::overlay::OverlayMsg::getType(), chord_routing_table::chord_routing_table::item::id, chord_routing_table::chord_routing_table::item::info, chord_routing_table::is_closest_to(), ariba::utility::Identifier::isUnspecified(), logging_debug, ariba::overlay::OverlayInterface::nodeid, ariba::overlay::Discovery::normal, ariba::overlay::OverlayInterface::OVERLAY_SERVICE_ID, ariba::overlay::Discovery::predecessor, chord_routing_table::remove(), ariba::overlay::BaseOverlay::route(), ariba::overlay::BaseOverlay::send(), ariba::overlay::OverlayMsg::setService(), ariba::overlay::Discovery::setTTL(), ariba::overlay::Discovery::setType(), setup(), ariba::overlay::Discovery::successor, table, ariba::utility::Identifier::toString(), ariba::overlay::typeDiscovery, ariba::overlay::typeLeave, and ariba::utility::LinkID::UNSPECIFIED.
const EndpointDescriptor & ariba::overlay::Chord::resolveNode | ( | const NodeID & | node | ) | [virtual] |
Implements ariba::overlay::OverlayInterface.
Definition at line 179 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, chord_routing_table::get(), ariba::overlay::BaseOverlay::getEndpointDescriptor(), chord_routing_table::chord_routing_table::item::info, ariba::utility::Identifier::isUnspecified(), table, and ariba::communication::EndpointDescriptor::UNSPECIFIED().
seqnum_t ariba::overlay::Chord::send | ( | OverlayMsg * | msg, | |
const LinkID & | link | |||
) | [private] |
helper: sends a message using the "base overlay"
Definition at line 104 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::utility::Identifier::isUnspecified(), and ariba::overlay::BaseOverlay::send_link().
Referenced by discover_neighbors(), and leaveOverlay().
void ariba::overlay::Chord::send_discovery_to | ( | const NodeID & | destination, | |
int | ttl = 3 | |||
) | [private] |
sends a discovery message
Definition at line 110 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::overlay::BaseOverlay::getEndpointDescriptor(), getNextLinkId(), ariba::utility::Identifier::isUnspecified(), ariba::overlay::OverlayInterface::nodeid, ariba::overlay::Discovery::normal, ariba::overlay::BaseOverlay::send_node(), ariba::overlay::OverlayMsg::setRegisterRelay(), chord_routing_table::size(), table, and ariba::overlay::typeDiscovery.
Referenced by eventFunction().
LinkID ariba::overlay::Chord::setup | ( | const EndpointDescriptor & | endp, | |
const NodeID & | node = NodeID::UNSPECIFIED | |||
) | [private] |
helper: sets up a link using the base overlay
Definition at line 78 of file Chord.cpp.
References ariba::overlay::OverlayInterface::baseoverlay, ariba::overlay::BaseOverlay::establishLink(), logging_debug, logging_info, ariba::overlay::OverlayInterface::OVERLAY_SERVICE_ID, pending, chord_routing_table::size(), table, ariba::communication::EndpointDescriptor::toString(), ariba::utility::Identifier::toString(), and ariba::utility::LinkID::UNSPECIFIED.
Referenced by joinOverlay(), and onMessage().
void ariba::overlay::Chord::showLinks | ( | ) | [private] |
Definition at line 459 of file Chord.cpp.
References chord_routing_table::get_predesessor(), chord_routing_table::get_successor(), logging_info, ariba::overlay::OverlayInterface::nodeid, table, and ariba::utility::Identifier::toString().
Referenced by onLinkUp().
ariba::overlay::Chord::use_logging_h | ( | Chord | ) | [private] |
vector<LinkID> ariba::overlay::Chord::bootstrapLinks [private] |
vector<NodeID> ariba::overlay::Chord::discovery [private] |
int ariba::overlay::Chord::discovery_count [private] |
int ariba::overlay::Chord::orphan_removal_counter [private] |
vector<NodeID> ariba::overlay::Chord::pending [private] |
int ariba::overlay::Chord::stabilize_counter [private] |
int ariba::overlay::Chord::stabilize_finger [private] |
chord_routing_table* ariba::overlay::Chord::table [private] |
Definition at line 76 of file Chord.h.
Referenced by Chord(), eventFunction(), getKnownNodes(), getNextLinkId(), leaveOverlay(), onLinkDown(), onLinkUp(), onMessage(), resolveNode(), send_discovery_to(), setup(), showLinks(), and ~Chord().