Hex walk-through
Worked example: footer revision 4 file
This walk-through reads the test fixture crates/strata-lsm/tests/fixtures/ranged_bloom. The fixture holds two files: the keyring keys (86 bytes) and the data file 0000000000000001.stc (8192 bytes). They were written by regenerate_the_ranged_bloom_fixture in crates/strata-lsm/tests/ranged_bloom_fixture.rs. The committed bytes predate footer revision 5; regenerating them with a current build would produce a revision 5 footer and a stats revision 2 frame.
What the fixture contains
Section titled “What the fixture contains”- 1000 puts, all at timestamp 7.
- Keys are
'a' ‖ iand'b' ‖ i, whereiis a 4-byte big-endian integer from 0 to 499. That is 500 keys under each of the two prefixes. - Values are the text
a-<i>andb-<i>. - The bloom filter excludes every key that starts with the prefix
"b".
The file is opened with the test master key from that source file. The key is deliberately not reproduced anywhere in this wiki, so the sealed regions below are shown as ciphertext or as their decrypted plaintext only.
Map of the data file
Section titled “Map of the data file”| Section | Offset | Sealed length | Notes |
|---|---|---|---|
| Data block 0 | 0 | 3234 | zstd, 880 entries |
| Data block 1 | 3234 | 638 | 120 entries |
| Bloom frame | 3872 | 684 | bloom_off in the footer |
| Stats frame | 4556 | 55 | bloom_off + bloom_len, up to index_off |
| Index frame | 4611 | 89 | index_off in the footer |
| Zero padding | 4700 | 3396 | brings the file to a multiple of 4096 |
| Footer | 8096 | 96 | the last 96 bytes of the 8192-byte file |
Read it in this order
Section titled “Read it in this order”A reader works from the end of the file backwards.
- The keyring: where the data key comes from.
- The footer: the last 96 bytes tell you where everything else is.
- The index frame: which blocks exist and where.
- The bloom frame: the filter and its ranged tail.
- The stats frame: per-block statistics.
- A data block: the first row-block entries.
- The block-counts fixture: the same idea with a footer revision 5.