SpreadProtocol » History » Version 18

J. Moringen, 10/31/2011 04:29 PM
updated according the changes made for #375

1 1 J. Wienke
h1. SpreadProtocol
2 1 J. Wienke
3 17 J. Moringen
{{>toc}}
4 17 J. Moringen
5 18 J. Moringen
This wiki page describes the protocol used by the Spread-based connectors.
6 1 J. Wienke
7 1 J. Wienke
h2. Data Format
8 1 J. Wienke
9 18 J. Moringen
Data exchanged on the wire by the Spread-based transport is encoded using "Google protocol buffers":http://code.google.com/apis/protocolbuffers/. A Spread message always contains a fragment of a notification (source:/trunk/protocol/rsb/protocol/FragmentedNotification.proto) as elementary communication unit. Descriptions of the Notification contents are given as comments on the descriptor files.
10 1 J. Wienke
11 1 J. Wienke
h2. Fragmentation
12 1 J. Wienke
13 18 J. Moringen
Because Spread has a message size limit, a single @Notification@ may not be sufficient to transport a whole event with a huge amount of user data. Hence, events may be encoded in several @FragmentedNotification@ s which are sent sequentially. Multiple @FragmentedNotification@ objects are constructed according to the following rules:
14 18 J. Moringen
* The size of individual fragments (i.e. serialized size of the @FragmentedNotification@ objects) must not exceed 100,000 octets
15 18 J. Moringen
* Fragment numbers are in the range [0, NUMBER-OF-FRAGMENTS - 1]
16 18 J. Moringen
* The fields which differ among @FragmentedNotification@ s for one event are:
17 18 J. Moringen
** The number of the fragment (@FragmentedNotification.data_part@ field)
18 18 J. Moringen
** The paylod data (@FragmentedNotification.notification.data@ field)
19 18 J. Moringen
** Which fields of the @Notification@ embedded in @FragmentedNotification.notification@ are present (see below)
20 18 J. Moringen
* Each of the @FragmentedNotification@ objects contains a @Notification@ object
21 18 J. Moringen
** The id of the event (@Notification.event_id@ field) is always present (to specify the event to which a fragment belongs)
22 18 J. Moringen
** For the initial fragment (fragment number 0), all fields of the embedded @Notification@ object are present
23 18 J. Moringen
** For subsequent fragments (fragment number >= 1), only the following fields of the embedded @Notification@ object are present:
24 18 J. Moringen
*** @Notification.event_id@
25 18 J. Moringen
*** @Notification.data@
26 2 J. Wienke
27 13 J. Moringen
h2. Hierarchical Bus
28 2 J. Wienke
29 8 J. Moringen
The hierarchical bus is created by sending each message to a group corresponding to its scope as well as groups corresponding to all super scopes including "/" (multigroup mulitcast).
30 8 J. Moringen
31 8 J. Moringen
_Example_
32 8 J. Moringen
<pre>
33 1 J. Wienke
super-scopes(/foo/bar/, include-self? = yes) = /, /foo/, /foo/bar/
34 8 J. Moringen
</pre>
35 2 J. Wienke
36 13 J. Moringen
h2. Group Names
37 3 J. Wienke
38 10 J. Moringen
Group names are created by applying the following steps to the fully formal scope string representation (*including trailing slash*):
39 10 J. Moringen
# Hash the scope string using "MD5":http://en.wikipedia.org/wiki/MD5.
40 10 J. Moringen
# Convert the 16 bytes of output to a 32 character string by concatenating the *zero-padded* hex (base-16) representations of the individual bytes.
41 10 J. Moringen
  Letters of the hex representation have to be lower case.
42 10 J. Moringen
# Remove the final character of the hex representation of the hash.
43 10 J. Moringen
  (Since spread group names can only be 32 bytes long _including the 0-terminator_)
44 7 J. Moringen
45 7 J. Moringen
_Example_
46 7 J. Moringen
<pre>
47 9 J. Moringen
/         -> "6666cd76f96956469e7be39d750cc7d\0"
48 1 J. Wienke
/foo/     -> "4f87be8f6e593d167f5fd1ab238cfc2\0"
49 9 J. Moringen
/foo/bar/ -> "1c184f3891344400380281315d9e738\0"
50 7 J. Moringen
</pre>
51 4 J. Wienke
52 13 J. Moringen
h2. Quality of Service
53 4 J. Wienke
54 1 J. Wienke
The following table explains how the 2D RSB QoS settings are mapped to spread message types.
55 1 J. Wienke
56 17 J. Moringen
|             |_.UNRELIABLE     |_.RELIABLE     |
57 17 J. Moringen
|_.UNORDERED  | UNRELIABLE_MESS | RELIABLE_MESS |
58 17 J. Moringen
|_.ORDERED    | FIFO_MESS       | FIFO_MESS     |
59 17 J. Moringen
60 17 J. Moringen
h2. Implementations
61 17 J. Moringen
62 17 J. Moringen
|_.Language   |_.File(s)/Directory                                   |
63 17 J. Moringen
| C++         | source:trunk/cpp/core/src/rsb/transport/spread       |
64 17 J. Moringen
| Java        | source:trunk/java/core/src/rsb/transport/spread      |
65 17 J. Moringen
| Python      | source:"trunk/python/core/rsb/rsbspread/__init__.py" |
66 17 J. Moringen
| Common Lisp | source:trunk/cl/cl-rsb/src/transport/spread          |