WAL block
A WAL block is 4096 bytes, sealed whole. It carries up to 4048 bytes of payload and ends with the 32-byte seal trailer.
Layout
Section titled “Layout”| Offset | Size | Type | Meaning |
|---|---|---|---|
| 0 | 4 | u32 LE | generation, the keyring epoch at write time |
| 4 | 2 | u16 LE | used, payload bytes in this block, at most 4048 |
| 6 | 2 | u16 LE | first_record, offset within the payload of the first record that starts in this block, or 0xFFFF if none |
| 8 | 8 | u64 LE | stream_offset, the logical stream offset of payload byte 0 |
| 16 | 4048 | bytes | payload (used bytes), zero-filled |
| 4064 | 32 | bytes | seal trailer |
- generation4 B
- used2 B
- first_record2 B
- stream_offset8 B
- payload4048 B
- trailer32 B
The AAD is "wal" ‖ segment ‖ block index, see AAD per object.
Validity
Section titled “Validity”A block is valid if and only if all of these hold:
- it is not all-zero,
- it authenticates,
generationequals the epoch in its own nonce (SPEC V64),usedis at most 4048,first_recordis0xFFFFor less thanused.