Changeset 12060 for source/ariba/Node.h


Ignore:
Timestamp:
Jun 19, 2013, 11:05:49 AM (11 years ago)
Author:
hock@…
Message:

Reintegrate branch: 20130111-hock-message_classes

improvements:

  • new message classes (reboost, zero-copy)
  • "fast path" for direct links (skip overlay layer)
  • link-properties accessible from the application
  • SystemQueue can call boost::bind functions
  • protlib compatibility removed (32bit overhead saved in every message)
  • addressing2
  • AddressDiscovery discoveres only addresses on which we're actually listening
  • ariba serialization usage reduced (sill used in OverlayMsg)
  • Node::connect, easier and cleaner interface to start-up ariba from the application
  • ariba configs via JSON, XML, etc (boost::property_tree)
  • keep-alive overhead greatly reduced
  • (relayed) overlay links can actually be closed now
  • lost messages are detected in most cases
  • notification to the application when link is transformed into direct-link
  • overlay routing: send message to second best hop if it would be dropped otherwise
  • SequenceNumbers (only mechanisms, so for: upward compatibility)
  • various small fixes


regressions:

  • bluetooth is not yet working again
  • bootstrap modules deactivated
  • liblog4xx is not working (use cout-logging)

This patch brings great performance and stability improvements at cost of backward compatibility.
Also bluetooth and the bootstrap modules have not been ported to the new interfaces, yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/Node.h

    r10653 r12060  
    4343namespace ariba {
    4444        class Node;
    45         namespace overlay {
    46                 class BaseOverlay;
    47         }
     45    namespace communication {
     46        class BaseCommunication;
     47    }
     48    namespace overlay {
     49        class BaseOverlay;
     50    }
    4851}
    4952
    5053#include <vector>
    5154#include <iostream>
    52 #include <boost/foreach.hpp>
     55#include <exception>
     56
    5357#include "Module.h"
    5458#include "Identifiers.h"
     
    5660#include "NodeListener.h"
    5761#include "Name.h"
    58 #include "AribaModule.h"
     62//#include "AribaModule.h"
    5963#include "CommunicationListener.h"
    6064#include "DataMessage.h"
    6165#include "SideportListener.h"
     66#include "ariba/overlay/SequenceNumber.h"
     67
     68// reboost messages
     69#include "ariba/utility/transport/messages/message.hpp"
     70
     71#include <boost/property_tree/ptree.hpp>
    6272
    6373using std::vector;
     
    6575
    6676namespace ariba {
     77
     78// typedef ariba::overlay::SequenceNumber SequenceNumber; // XXX see CommunicationListener
     79
     80using boost::property_tree::ptree;
     81
     82// sendMessage-Priorities
     83struct send_priority
     84{
     85    enum SEND_PRIORITY
     86    {
     87        HIGHEST = 2,
     88        HIGHER = 3,
     89        NORMAL = 4,
     90        LOWER = 5,
     91        LOWEST = 6
     92    };
     93};
     94
     95
    6796
    6897/**
     
    75104 * @author Christoph Mayer <mayer@tm.uka.de>
    76105 */
     106// TODO do we really want to inherit from Module.. ?
    77107class Node: public Module {
    78108public:
     109   
    79110        /**
    80111         * Constructs a new node using a given ariba module
     
    86117         *   is a zero-terminated char-string.
    87118         */
    88         Node(AribaModule& ariba_mod, const Name& node_name = Name::UNSPECIFIED);
     119//      Node(AribaModule& ariba_mod, const Name& node_name = Name::UNSPECIFIED);
     120       
     121        // XXX EXPERIMENTAL
     122        Node();
    89123
    90124        /**
     
    100134        //--- node control ---
    101135
     136    /**
     137     * XXX EXPERIMENTAL
     138     *
     139     * Replaces initialte & join
     140     */
     141    void connect(const ptree& config);
     142
     143    // XXX DEPRECATED
    102144        /**
    103145         * This method instructs the node to join a particular spovnet.
     
    107149         * @param vnetId The SpoVNet name
    108150         */
    109         void join(const Name& name);
     151//      void join(const Name& name);
    110152
    111153        /**
     
    116158         * @param param The SpoVNet properties
    117159         */
    118         void initiate(const Name& name, const SpoVNetProperties& parm =
    119                         SpoVNetProperties::DEFAULT);
     160//      void initiate(const Name& name, const SpoVNetProperties& parm =
     161//                      SpoVNetProperties::DEFAULT);
    120162
    121163        /**
     
    221263        void dropLink(const LinkID& lnk);
    222264
    223         // message sending
    224 
    225         /**
    226          * Sends a one-shot message to a service. If link properties are specified,
    227          * the node tries to fulfill those requirements. This may cause the node
    228          * to first establish a temporary link, second sending the message and last
    229          * dropping the link. This would result in a small amount of extra latency
    230          * until the message is delivered. If reliable transport was selected,
    231          * the method returns a sequence number and a communication event is
    232          * triggered on message delivery or loss.
    233          *
    234          * @param msg The message to be sent
    235          * @param nid The remote node identifier
    236          * @param sid The remote service identifier
    237          * @param req The requirements associated with the message
    238          * @return A sequence number
    239          */
     265        /**
     266         * Returns whether a link is direct or relayed over other nodes
     267         * @param lnk LinkID of the link
     268         * @return true if link is direct; false otherwise
     269         */
     270        bool isLinkDirect(const ariba::LinkID& lnk) const;
     271       
     272        /**
     273         * Returns the latest measured hop count on this link.
     274         * NOTE: This is not guaranteed to be up to date.
     275         *
     276         * @param lnk LinkID of the link
     277         * @return overlay hop count on this link
     278         */
     279        int getHopCount(const ariba::LinkID& lnk) const;
     280       
     281       
     282        /* +++++ Message sending +++++ */
     283
     284       
     285    /**
     286     * Sends a message via an established link. If reliable transport was
     287     * selected, the method returns a sequence number and a communication event
     288     * is triggered on message delivery or loss.
     289     *
     290     * +++ New interface, using efficient zero-copy reboost messages. +++
     291     *
     292     * @param msg The message to be sent
     293     * @param lnk The link to be used for sending the message
     294     */
     295    const SequenceNumber& sendMessage(reboost::message_t msg, const LinkID& lnk, uint8_t priority=send_priority::NORMAL);
     296
     297    /**
     298     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
     299     */   
     300    seqnum_t sendMessage(const DataMessage& msg, const LinkID& lnk);
     301
     302   
     303    /**
     304     * Sends a one-shot message to a service. If link properties are specified,
     305     * the node tries to fulfill those requirements. This may cause the node
     306     * to first establish a temporary link, second sending the message and last
     307     * dropping the link. This would result in a small amount of extra latency
     308     * until the message is delivered. If reliable transport was selected,
     309     * the method returns a sequence number and a communication event is
     310     * triggered on message delivery or loss.
     311     *
     312     * +++ New interface, using efficient zero-copy reboost messages. +++
     313     *
     314     * @param msg The message to be sent
     315     * @param nid The remote node identifier
     316     * @param sid The remote service identifier
     317     * @param req The requirements associated with the message
     318     * @return A sequence number
     319     */
     320    const SequenceNumber& sendMessage(reboost::message_t msg, const NodeID& nid, const ServiceID& sid,
     321            uint8_t priority=send_priority::NORMAL, const LinkProperties& req = LinkProperties::DEFAULT);
     322
     323    /**
     324     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
     325     */
    240326        seqnum_t sendMessage(const DataMessage& msg, const NodeID& nid, const ServiceID& sid,
    241327                        const LinkProperties& req = LinkProperties::DEFAULT);
    242328
    243         /**
    244          * like the above function, but sends the message to the closest directly known node
    245          * to the specified address
    246          */
     329   
     330    /**
     331     * like the above function, but sends the message to the closest directly known node
     332     * to the specified address
     333     *
     334     * +++ New interface, using efficient zero-copy reboost messages. +++
     335     *
     336     */
     337    NodeID sendMessageCloserToNodeID(reboost::message_t msg, const NodeID& nid, const ServiceID& sid,
     338            uint8_t priority=send_priority::NORMAL, const LinkProperties& req = LinkProperties::DEFAULT);
     339
     340    /**
     341     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
     342     */
    247343    NodeID sendMessageCloserToNodeID(const DataMessage& msg, const NodeID& nid, const ServiceID& sid,
    248344            const LinkProperties& req = LinkProperties::DEFAULT);
    249345
    250         /**
    251          * Sends a message via an established link. If reliable transport was
    252          * selected, the method returns a sequence number and a communication event
    253          * is triggered on message delivery or loss.
    254          *
    255          * @param msg The message to be sent
    256          * @param lnk The link to be used for sending the message
    257          */
    258         seqnum_t sendMessage(const DataMessage& msg, const LinkID& lnk);
    259 
    260         /**
    261          * Sends a message to all known hosts in the overlay structure
    262          * the nodes that are reached here depend on the overlay structure.
    263          *
    264          * @param msg The message to be send
    265          * @param sid The id of the service that should receive the message
    266          * @see getNeighborNodes
    267          */
     346       
     347    /**
     348     * Sends a message to all known hosts in the overlay structure
     349     * the nodes that are reached here depend on the overlay structure.
     350     *
     351     * +++ New interface, using efficient zero-copy reboost messages. +++
     352     *
     353     * @param msg The message to be send
     354     * @param sid The id of the service that should receive the message
     355     * @see getNeighborNodes
     356     */
     357        void sendBroadcastMessage(reboost::message_t msg, const ServiceID& sid, uint8_t priority=send_priority::NORMAL);
     358
     359    /**
     360     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
     361     */
    268362        void sendBroadcastMessage(const DataMessage& msg, const ServiceID& sid);
    269363
     364       
     365        /* +++++ [Message sending] +++++ */
     366       
     367       
     368       
    270369        // --- communication listeners ---
    271370
     
    313412        /** @see Module.h */
    314413        string getName() const;
    315 
     414       
     415       
     416private:
     417        inline void check_send_priority(uint8_t priority);
     418
     419       
    316420protected:
    317421        // friends
     
    320424        // member variables
    321425        Name name;                             //< node name
    322         AribaModule& ariba_mod;                //< ariba module
     426//      AribaModule* ariba_mod;                //< ariba module
    323427        SpoVNetID spovnetId;                   //< current spovnet id
    324428        NodeID nodeId;                             //< current node id
     429        communication::BaseCommunication* base_communication;
    325430        overlay::BaseOverlay* base_overlay;    //< the base overlay
    326431
Note: See TracChangeset for help on using the changeset viewer.