Footer
The footer is the last 96 bytes of a SEAM data file, at size - 96. It is the entry point for readers: it holds the file id, the position of the bloom and index frames, entry counts and timestamp bounds.
The footer is the one section that is not a frame. It is 64 bytes of plaintext followed by a 32-byte seal trailer, sealed with the AAD whose section byte is 0x03 (see AAD per object). The footer is encrypted, so its magic is visible only after authentication.
Layout of the 64-byte plaintext
Section titled “Layout of the 64-byte plaintext”| Offset | Size | Type | Meaning |
|---|---|---|---|
| 0 | 4 | ascii | magic "STC1" |
| 4 | 2 | u16 LE | version, which holds the footer revision (1 to 5) |
| 6 | 1 | u8 | layer: 1 hot/row, 2 columnar, 3 cold |
| 7 | 1 | u8 | flags, see Footer flags |
| 8 | 8 | u64 LE | file_id, must equal the id in the file name |
| 16 | 8 | u64 LE | bloom_off |
| 24 | 4 | u32 LE | bloom_len, the sealed frame length |
| 28 | 8 | u64 LE | index_off |
| 36 | 4 | u32 LE | index_len |
| 40 | 8 | u64 LE | entries |
| 48 | 8 | u64 LE | min_ts |
| 56 | 8 | u64 LE | max_ts |
- magic4 B"STC1"
- version2 B
- layer1 B
- flags1 B
- file_id8 B
- bloom_off8 B
- bloom_len4 B
- index_off8 B
- index_len4 B
- entries8 B
- min_ts8 B
- max_ts8 B
- trailer32 Bseal trailer
Flags in short
Section titled “Flags in short”| Flag | Value | Meaning |
|---|---|---|
STATS |
0x01 |
a stats frame exists |
BLOOM_SKIP |
0x02 |
the bloom has a skip tail |
BLOOM_RANGES |
0x04 |
the bloom has a ranged tail |
BLOCK_COUNTS |
0x08 |
stats carry per-block version codes |
Details are on Footer flags.
Revisions and legal flags
Section titled “Revisions and legal flags”The version field holds the footer’s revision. Only these flag combinations are legal (parse_footer, sst.rs:1501). STATS is optional in revisions 1 to 4 and required in revision 5.
| Revision | Name | Legal flags | Writer chooses it when | Written by SEAM 1 |
|---|---|---|---|---|
| 1 | plain | no SKIP, no RANGES, no COUNTS | none of the below | no, read-only |
| 2 | bloom skip | SKIP set, no RANGES, no COUNTS | skip tags present | no, read-only |
| 3 | codec | no RANGES, no COUNTS (SKIP free) | an LZ4 frame was written | no, read-only |
| 4 | ranged bloom | SKIP and RANGES set, no COUNTS | at least one key was left out by a bloom-off prefix (SPEC V729) | no, read-only |
| 5 | block counts | STATS and COUNTS set; RANGES implies SKIP | the file has a stats frame (default for every new file) | yes |
How a writer decides is on Choosing a footer revision.
Reader rules
Section titled “Reader rules”versiongreater than 5 isNewerFormat("sst footer").- A magic mismatch or version 0 is
Corrupt. - The file id must match.
bloom_off + bloom_lenmust be at mostsize - 96.index_off + index_lenmust be at mostsize - 96.index_offmust be at leastbloom_off.
Revisions 4 and 5 and the stamp
Section titled “Revisions 4 and 5 and the stamp”Footer revisions 4 and 5 were introduced without a store-format bump (SPEC V729, V737), because the footer describes its own revision. Their files are readable by any build that knows them, and older builds fail with NewerFormat("sst footer"). Current builds write revision 5 for every file; revision 4 is read-only. See Compatibility rules.