Skip to content

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.

  • 1000 puts, all at timestamp 7.
  • Keys are 'a' ‖ i and 'b' ‖ i, where i is 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> and b-<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.

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

A reader works from the end of the file backwards.

  1. The keyring: where the data key comes from.
  2. The footer: the last 96 bytes tell you where everything else is.
  3. The index frame: which blocks exist and where.
  4. The bloom frame: the filter and its ranged tail.
  5. The stats frame: per-block statistics.
  6. A data block: the first row-block entries.
  7. The block-counts fixture: the same idea with a footer revision 5.