---
config:
packet:
bitsPerRow: 32
---
packet-beta
0-63: "sequence: fixed64"
64-95: "count: fixed32"
96-255: "data: record[count]"
---
config:
packet:
bitsPerRow: 32
---
packet-beta
0-7: "type: kTypeValue"
8-15: "key_len: varint32"
16-47: "key_data: uint8[key_len]"
48-55: "value_len: varint32"
56-87: "value_data: uint8[value_len]"
---
config:
packet:
bitsPerRow: 32
---
packet-beta
0-7: "type: kTypeDeletion"
8-15: "key_len: varint32"
16-47: "key_data: uint8[key_len]"
WriteBatch::rep_ :=
sequence: fixed64
count: fixed32
data: record[count]
record :=
kTypeValue varstring varstring |
kTypeDeletion varstring
varstring :=
len: varint32
data: uint8[len]
PUT and DELETE have different record structure.
We will use WriteBatch as the actuall format in our WAL.
sequence: 8 bytes, the index of sequencecount: 4 bytes, the count of operationsrecord: the record ofPUTandDELETEopreation- kTypeValue varstring(key) varstring(value) (for
PUT) - kTypeDeletion varstring(key) (for
DELETION) -
Here,
varint32anduint8[len]make thevarstring, which can be understanded as [key_len key_value] or [data_len data_value]
- kTypeValue varstring(key) varstring(value) (for