forked from Netflix/dynomite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dyn_protocol.txt
46 lines (34 loc) · 1.5 KB
/
dyn_protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Dyn message Protocol:
I. Specification:
1. Structure format
<MagicNumber> <Space>
<MessageId> <Space>
<TypeId> <Space>
<BitField> <Space>
<Version> <Space>
<Same-dc> <Space>
*<Number of data bytes> <Space>
<Data> <space>
*<Number of payload bytes> <CR LF>
<Memcache or Redis payload>
2. Field descriptions
a. MagicNumber: it is always 2014
b. MessageId: sequence id of a message
c. TypeId: please see the code for the list.
d. BitField: indicate whether compression and/or encryption. Right most bit indicates encryption.
The 2nd bit from the right indicates a compressed message.
e. Version: version of the msg. This usually depends on the version of the dynomite.
This is needed during upgrading a live cluster with mixed versions.
f. Same-dc: bit to indicate whether the communication is inter-dcs.
We should later to exchange node's metadata like rack, dc, and ip.
3. Example:
This is a dynomite message that carries a Redis' "get foo" request:
"2014 1344 5 1 1 0\r\n*4 minh\r\n*2\r\n$3\r\nget\r\n$3\r\nfoo\r\n"
where "*2\r\n$3\r\nget\r\n$3\r\nfoo\r\n" is Redis' payload for "get foo" cmd.
II. Bit field for encryption/decryption
III. Compression
We currently don't support compression but it should be similar to the way how
encryption/decryption works. We will support/implement this feature in the near future
if there is a demand for it.
IV. Payload size
Will fill in soon