@@ -21,12 +21,16 @@ with the following header and be encoded as a `Message` (defined in
21
21
22
22
### Liftbridge Envelope Header
23
23
24
+ All Liftbridge messages and RPCs sent over NATS are prefixed with an envelope
25
+ header. This includes client-facing messages, such as publishes and acks, as
26
+ well as internal RPCs like replication.
27
+
24
28
```
25
29
0 8 16 24 32
26
30
├───────────────┴───────────────┴───────────────┴───────────────┤
27
31
│ Magic Number │
28
32
├───────────────┬───────────────┬───────────────┬───────────────┤
29
- │ Version │ HeaderLen │ Flags │ Reserved │
33
+ │ Version │ HeaderLen │ Flags │ MsgType │
30
34
├───────────────┴───────────────┴───────────────┴───────────────┤
31
35
│ CRC-32C (optional) │
32
36
└───────────────────────────────────────────────────────────────┘
@@ -45,6 +49,8 @@ bumped if the envelope format changes or if the message encoding changes in a
45
49
non-backwards-compatible way. Adding fields to the messages should not require
46
50
a version bump.
47
51
52
+ Currently, the only supported protocol version is v0, i.e. ` 0x00 ` .
53
+
48
54
#### HeaderLen [ 1 byte]
49
55
50
56
The header length is the offset of the payload. This is included primarily for
@@ -55,9 +61,31 @@ safety.
55
61
The flag bits are defined as follows:
56
62
57
63
| Bit | Description |
58
- | --- | - -------------- |
64
+ | :-- | : -------------- |
59
65
| 0 | CRC-32C enabled |
60
66
67
+ #### MsgType [ 1 byte]
68
+
69
+ This is the Liftbridge-specific message type the envelope contains:
70
+
71
+ | MsgType | Name | Description | Internal |
72
+ | :------ | :------------------------ | :----------------------------------------------------- | :------- |
73
+ | 0 | Publish | Client-published message | no |
74
+ | 1 | Ack | Server-published ack | no |
75
+ | 2 | ReplicationRequest | Request to replicate partition data | yes |
76
+ | 3 | ReplicationResponse | Response to ReplicationRequest | yes |
77
+ | 4 | RaftJoinRequest | Request to join Raft cluster | yes |
78
+ | 5 | RaftJoinResponse | Response to RaftJoinRequest | yes |
79
+ | 6 | LeaderEpochOffsetRequest | Request for partition leader's latest offset for epoch | yes |
80
+ | 7 | LeaderEpochOffsetResponse | Response to LeaderEpochOffsetRequest | yes |
81
+ | 8 | PropagatedRequest | Request forwarded to metadata leader | yes |
82
+ | 9 | PropagatedResponse | Response to PropagatedRequest | yes |
83
+ | 10 | ServerInfoRequest | Request for cluster information | yes |
84
+ | 11 | ServerInfoResponse | Response to ServerInfoRequest | yes |
85
+ | 12 | PartitionStatusRequest | Request to get partition status | yes |
86
+ | 13 | PartitionStatusResponse | Response to PartitionStatusRequest | yes |
87
+ | 14 | PartitionNotification | Signal new data is available for partition | yes |
88
+
61
89
#### CRC-32C [ 4 bytes, optional]
62
90
63
91
The CRC-32C (Castagnoli) is the checksum of the payload (i.e. from HeaderLen to
0 commit comments