Ignore:
Timestamp:
May 26, 2009, 1:40:23 AM (15 years ago)
Author:
mies
Message:

Merged 20090512-mies-connectors changes r3472:r3689 into trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/modules/chord/Chord.h

    r3689 r3690  
    1 // [Licence]
     1// [License]
    22// The Ariba-Underlay Copyright
    33//
     
    3535// official policies, either expressed or implied, of the Institute of
    3636// Telematics.
    37 // [Licence]
     37// [License]
    3838
    3939#ifndef CHORD_H_
    4040#define CHORD_H_
    4141
     42#include "ariba/utility/system/Timer.h"
    4243#include "ariba/utility/logging/Logging.h"
    4344#include "ariba/communication/EndpointDescriptor.h"
     45#include "../OverlayInterface.h"
     46#include <vector>
     47
     48class chord_routing_table;
    4449
    4550namespace ariba {
    4651namespace overlay {
    4752
    48 using ariba::overlay::OverlayInterface;
    4953using ariba::communication::EndpointDescriptor;
     54using ariba::utility::Timer;
    5055
    51 class Chord : public OverlayInterface {
     56using 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 */
     71class Chord : public OverlayInterface, protected Timer {
    5272        use_logging_h( Chord );
    5373private:
     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 );
    5488
    5589public:
    5690        Chord(BaseOverlay& _baseoverlay, const NodeID& _nodeid,
    5791                        OverlayStructureEvents* _eventsReceiver);
    58         ~Chord();
     92        virtual ~Chord();
    5993
    60         void createOverlay();
     94        /// @see OverlayInterface.h
     95        virtual void createOverlay();
    6196
    62         void deleteOverlay();
     97        /// @see OverlayInterface.h
     98        virtual void deleteOverlay();
    6399
    64         void joinOverlay(
    65                 const EndpointDescriptor& bootstrapEp = EndpointDescriptor::UNSPECIFIED
     100        /// @see OverlayInterface.h
     101        virtual void joinOverlay(
     102                const EndpointDescriptor& boot = EndpointDescriptor::UNSPECIFIED
    66103        );
    67104
    68         void leaveOverlay();
     105        /// @see OverlayInterface.h
     106        virtual void leaveOverlay();
    69107
    70         const EndpointDescriptor& resolveNode( const NodeID& node );
     108        /// @see OverlayInterface.h
     109        virtual const EndpointDescriptor& resolveNode( const NodeID& node );
    71110
    72         void routeMessage( const NodeID& destnode, Message* msg );
     111        /// @see OverlayInterface.h
     112        virtual void routeMessage( const NodeID& destnode, Message* msg );
    73113
    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();
    75129};
    76130
Note: See TracChangeset for help on using the changeset viewer.