Changeset 12060 for source/services


Ignore:
Timestamp:
Jun 19, 2013, 11:05:49 AM (12 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.

Location:
source/services/ariba_dht
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • source/services/ariba_dht/Dht.cpp

    r10700 r12060  
    4848void Dht::get(const std::string& key)
    4949{
    50         DhtMessage msg(DhtMessage::DhtGet, key);
     50        DhtMessage msg(DhtMessage::DhtGet, key, node->getNodeId());
    5151       
    5252        handle_dht_message(msg, NodeID::UNSPECIFIED);
     
    155155            case DhtMessage::DhtGet:
    156156            {
    157                 answer_dht_request(message.getKey(), source);
     157                answer_dht_request(message.getKey(), message.getSourceNode());
    158158
    159159                break;
     
    167167                                message.getValues(),
    168168                                message.getTTL());
    169                 answer_dht_request(message.getKey(), source);
     169                answer_dht_request(message.getKey(), message.getSourceNode());
    170170               
    171171                break;
  • source/services/ariba_dht/Dht.h

    r10700 r12060  
    2424using ariba::utility::SystemEventType;
    2525using ariba::utility::SystemEventListener;
     26
     27using ariba::utility::NodeID;
     28using ariba::utility::LinkID;
     29
    2630
    2731// Forward declarations to avoid adding messages/*.h to the public interface
  • source/services/ariba_dht/messages/DhtMessage.cpp

    r10700 r12060  
    1010DhtMessage::DhtMessage() :
    1111        ttl( 0 ),
    12         replace( false )
     12        replace( false ),
     13        sourceNode(NodeID::UNSPECIFIED)
    1314{}
    1415
    15 DhtMessage::DhtMessage( DhtMessageType type, const std::string& key ) :
     16DhtMessage::DhtMessage( DhtMessageType type, const std::string& key, const NodeID& sourceNodeID ) :
    1617        type( static_cast<uint8_t>(type) ),
    1718        ttl( 0 ),
    1819        replace( false ),
    19         key( key )
     20        key( key ),
     21        sourceNode(sourceNodeID)
     22
    2023{}
    2124
    2225DhtMessage::DhtMessage( DhtMessageType type, const std::string& key,
    23                 const std::string& value, uint16_t ttl ) :
     26                const std::string& value, uint16_t ttl, const NodeID& sourceNodeID ) :
    2427        type( static_cast<uint8_t>(type) ),
    2528        ttl( ttl ),
    2629        replace( false ),
    2730        key( key ),
    28         values(1, value)
     31        values(1, value),
     32        sourceNode(sourceNodeID)
    2933{}
    3034
    3135DhtMessage::DhtMessage( DhtMessageType type, const std::string& key,
    32                 const vector<string>& values, uint16_t ttl ) :
     36                const vector<string>& values, uint16_t ttl, const NodeID& sourceNodeID ) :
    3337        type( static_cast<uint8_t>(type) ),
    3438        ttl( ttl ),
    3539        replace( false ),
    36         key( key )
     40        key( key ),
     41        sourceNode(sourceNodeID)
    3742{
    3843        // preallocate enough room so we don't need to copy a lot
     
    4651}
    4752
     53string DhtMessage::DhtMessageTypeToString(DhtMessageType type) {
     54        string temp;
     55        switch (type)
     56        {
     57                case DhtMessage::DhtInvalid:
     58                {
     59                        temp = "DhtInvalid";
     60                        break;
     61                }
     62
     63                case DhtMessage::DhtGet:
     64                {
     65                        temp = "DhtGet";
     66                        break;
     67                }
     68
     69                case DhtMessage::DhtPut:
     70                {
     71                        temp = "DhtPut";
     72                        break;
     73                }
     74
     75                case DhtMessage::DhtPutAndGet:
     76                {
     77                        temp = "DhtPutAndGet";
     78                        break;
     79                }
     80
     81                case DhtMessage::DhtRemove:
     82                {
     83                        temp = "DhtRemove";
     84                        break;
     85                }
     86
     87                case DhtMessage::DhtRepublish:
     88                {
     89                        temp = "DhtRepublish";
     90                        break;
     91                }
     92
     93                case DhtMessage::DhtAnswer:
     94                {
     95                        temp =  "DhtAnswer";
     96                        break;
     97                }
     98
     99                case DhtMessage::DhtReplica:
     100                {
     101                        temp = "DhtReplica";
     102                        break;
     103                }
     104        }
     105
     106        return temp;
     107}
     108
    48109}}
  • source/services/ariba_dht/messages/DhtMessage.h

    r10700 r12060  
    33
    44#include "ariba/utility/messages.h"
     5#include "ariba/utility/types/NodeID.h"
    56#include "ariba/utility/serialization.h"
    67#include "ariba/Name.h"
     
    1011
    1112using ariba::utility::Message;
     13using ariba::utility::NodeID;
    1214using_serialization;
    1315
     
    2123                DhtRemove = 4,
    2224                DhtRepublish = 5,
    23                 DhtAnswer = 8
     25                DhtAnswer = 8,
     26                DhtReplica = 9
    2427        } DhtMessageType;
    2528       
    2629        DhtMessage();
    27         DhtMessage( DhtMessageType type, const std::string& key );
     30        DhtMessage( DhtMessageType type, const std::string& key, const NodeID& sourceNodeID = NodeID::UNSPECIFIED);
    2831        DhtMessage( DhtMessageType type, const std::string& key,
    29                         const std::string& value, uint16_t ttl = 0 );
     32                        const std::string& value, uint16_t ttl = 0, const NodeID& sourceNodeID = NodeID::UNSPECIFIED );
    3033       
    3134        DhtMessage( DhtMessageType type, const std::string& key,
    32                         const vector<std::string>& values, uint16_t ttl = 0 );
     35                        const vector<std::string>& values, uint16_t ttl = 0, const NodeID& sourceNodeID = NodeID::UNSPECIFIED );
    3336       
    3437        virtual ~DhtMessage();
     
    7780        }
    7881
     82        NodeID getSourceNode() const {
     83                return sourceNode;
     84        }
     85
    7986        bool doReplace() const {
    8087                return replace;
    8188        }
    8289
     90        static string DhtMessageTypeToString(DhtMessageType type);
    8391
    84 private:
     92protected:
    8593        uint8_t type;
    8694        uint16_t ttl;
     
    8896        std::string key;
    8997        vector<std::string> values;
     98        NodeID sourceNode;
     99
     100private:
    90101};
    91102
     
    100111        // key serialization
    101112        X && T(key);
     113
     114        X && &sourceNode;
    102115
    103116        // store number of values
Note: See TracChangeset for help on using the changeset viewer.