Edit encoding
Each MANIFEST record decrypts to one edit. The first record of the file is a full snapshot; later ones change it. Integers marked varint use the varint encoding.
Layout
Section titled “Layout”varint n_addsn_adds x add: level u8 varint id, varint size, varint entries, varint min_ts, varint max_ts key smallest, key largest key = varint len ‖ user bytes ‖ varint tsvarint n_removes ‖ n_removes x varint idopt replay_from opt = 0x00 | 0x01 ‖ varintopt next_file[ varint n (must == n_adds) ‖ n x location u8 ] 0 = local, 1 = remote; omitted only by very old writerstagged section* tag u8 ‖ body, any order, each at most once| Field | Encoding | Meaning |
|---|---|---|
n_adds |
varint | number of added files |
| add | see File entry (add) | one per added file |
n_removes, ids |
varint, varint each | ids of files to remove |
replay_from |
0x00, or 0x01 followed by a varint |
WAL stream offset, optional |
next_file |
same optional encoding | lower bound for the next file id, optional |
| locations | varint n equal to n_adds, then n bytes |
0 local, 1 remote; omitted only by very old writers |
| tagged sections | tag byte then body | see Tagged sections |
Tagged sections may come in any order. A repeat of tag 1, 4, 5 or 7 is Corrupt("manifest trailing bytes"); a repeat of tag 2 is not detected and overwrites the first. Writers emit them in the order 1, 2, 4, 5, 7. Any other tag, including 3 and 6, is Corrupt("manifest trailing bytes").
Applying an edit
Section titled “Applying an edit”See State and levels.