Manifest format
The byte layout of a manifest, m/<generation>.mft. What a manifest means is in design.md.
| u32 | magic | "OLGN" (0x4f4c474e) |
| u32 | version | 5 |
| u64 | generation | |
| u64 | through | |
| marks block | ||
| u32 | run count | |
| run 0 | ||
| … | ||
| u32 | crc32 | of every byte before it |
| per run | ||
|---|---|---|
| u16 | path length | |
| path | UTF-8, relative to the database root | |
| u32 | bytes | size of the run file |
| u8 | has range | |
| u32 | length | if has range |
| smallest key | ||
| u32 | length | |
| largest key | ||
| u64 | marksThrough | |
| marks block | ||
| u32 | count | 0 is valid: no marks |
| mark 0 | ||
| … | ||
| per mark | ||
| u32 | start length | |
| start | the first key of the range | |
| u8 | has end | |
| u32 | length | exclusive if has end |
| end key | ||
| u64 | through | |
| u64 | at | |
bytes and the key range let the compaction planner size and route levels without opening a file. The level of a run is in its path.
Runs are listed L0 first, newest first. Each deeper level follows, with its runs sorted by smallest key. Reads use that order directly.
The marks block holds the marks, in no particular order, and marksThrough is a run's claim against them. design.md gives the meaning of both.
A reader rejects any other version as corrupt, and a marks block that breaks its rules, a mark with through 0, an end not above its start, at at or below its through or past the manifest's through, or a run whose marksThrough is past it.