Changeset 3690 for source/ariba/overlay/modules/chord/Chord.h
- Timestamp:
- May 26, 2009, 1:40:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/modules/chord/Chord.h
r3689 r3690 1 // [Licen ce]1 // [License] 2 2 // The Ariba-Underlay Copyright 3 3 // … … 35 35 // official policies, either expressed or implied, of the Institute of 36 36 // Telematics. 37 // [Licen ce]37 // [License] 38 38 39 39 #ifndef CHORD_H_ 40 40 #define CHORD_H_ 41 41 42 #include "ariba/utility/system/Timer.h" 42 43 #include "ariba/utility/logging/Logging.h" 43 44 #include "ariba/communication/EndpointDescriptor.h" 45 #include "../OverlayInterface.h" 46 #include <vector> 47 48 class chord_routing_table; 44 49 45 50 namespace ariba { 46 51 namespace overlay { 47 52 48 using ariba::overlay::OverlayInterface;49 53 using ariba::communication::EndpointDescriptor; 54 using ariba::utility::Timer; 50 55 51 class Chord : public OverlayInterface { 56 using namespace std; 57 58 /** 59 * This class implements a structured overlay inspired by chord. 60 * It differs to the original form of chord in the following manner: 61 * 62 * (1) The graph is bidirectional 63 * (2) Stabilization is done in a reactive manner 64 * 65 * It therefore can be considered as a kind of Chorded-Kademlia :) 66 * 67 * The resulting overlay graph has a diameter of O(log N). 68 * 69 * @author Sebastian Mies <mies@tm.uka.de> 70 */ 71 class Chord : public OverlayInterface, protected Timer { 52 72 use_logging_h( Chord ); 53 73 private: 74 chord_routing_table* table; 75 int orphan_removal_counter; 76 int stabilize_counter; 77 int stabilize_finger; 78 LinkID bootstrapLink; 79 80 // helper: sets up a link using the "base overlay" 81 LinkID setup( const EndpointDescriptor& endp ); 82 83 // helper: sends a message using the "base overlay" 84 seqnum_t send( Message* msg, const LinkID& link ); 85 86 // stabilization: sends a discovery message to the specified neighborhood 87 void send_discovery_to( const NodeID& destination, int ttl = 4 ); 54 88 55 89 public: 56 90 Chord(BaseOverlay& _baseoverlay, const NodeID& _nodeid, 57 91 OverlayStructureEvents* _eventsReceiver); 58 ~Chord();92 virtual ~Chord(); 59 93 60 void createOverlay(); 94 /// @see OverlayInterface.h 95 virtual void createOverlay(); 61 96 62 void deleteOverlay(); 97 /// @see OverlayInterface.h 98 virtual void deleteOverlay(); 63 99 64 void joinOverlay( 65 const EndpointDescriptor& bootstrapEp = EndpointDescriptor::UNSPECIFIED 100 /// @see OverlayInterface.h 101 virtual void joinOverlay( 102 const EndpointDescriptor& boot = EndpointDescriptor::UNSPECIFIED 66 103 ); 67 104 68 void leaveOverlay(); 105 /// @see OverlayInterface.h 106 virtual void leaveOverlay(); 69 107 70 const EndpointDescriptor& resolveNode( const NodeID& node ); 108 /// @see OverlayInterface.h 109 virtual const EndpointDescriptor& resolveNode( const NodeID& node ); 71 110 72 void routeMessage( const NodeID& destnode, Message* msg ); 111 /// @see OverlayInterface.h 112 virtual void routeMessage( const NodeID& destnode, Message* msg ); 73 113 74 NodeList getKnownNodes() const; 114 /// @see OverlayInterface.h 115 virtual NodeList getKnownNodes() const; 116 117 /// @see CommunicationListener.h or @see OverlayInterface.h 118 virtual void onLinkUp(const LinkID& lnk, const NodeID& remote); 119 120 /// @see CommunicationListener.h or @see OverlayInterface.h 121 virtual void onLinkDown(const LinkID& lnk, const NodeID& remote); 122 123 /// @see CommunicationListener.h or @see OverlayInterface.h 124 virtual void onMessage(const DataMessage& msg, const NodeID& remote, 125 const LinkID& lnk = LinkID::UNSPECIFIED); 126 127 /// @see Timer.h 128 virtual void eventFunction(); 75 129 }; 76 130
Note:
See TracChangeset
for help on using the changeset viewer.