參考 Thrift THeader 協(xié)議 ,我們?cè)O(shè)計(jì)了 TTheader 協(xié)議。
0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f
+----------------------------------------------------------------+
| 0| LENGTH |
+----------------------------------------------------------------+
| 0| HEADER MAGIC | FLAGS |
+----------------------------------------------------------------+
| SEQUENCE NUMBER |
+----------------------------------------------------------------+
| 0| HEADER SIZE | ...
+---------------------------------
Header is of variable size:
(and starts at offset 14)
+----------------------------------------------------------------+
| PROTOCOL ID |NUM TRANSFORMS . |TRANSFORM 0 ID (uint8)|
+----------------------------------------------------------------+
| TRANSFORM 0 DATA ...
+----------------------------------------------------------------+
| ... ... |
+----------------------------------------------------------------+
| INFO 0 ID (uint8)| INFO 0 DATA ...
+----------------------------------------------------------------+
| ... ... |
+----------------------------------------------------------------+
| |
| PAYLOAD |
| |
+----------------------------------------------------------------+
其中:
Header 部分長(zhǎng)度 bytes 數(shù)必須是 4 的倍數(shù),不足部分用 ?0x00
? 填充
表示壓縮方式,為預(yù)留字段,暫不支持,取值有:
zlib
?壓縮數(shù)據(jù);snappy
?壓縮數(shù)據(jù);用于傳遞一些 kv 對(duì)信息,取值有:
更多建議: