Skip to content

Quick tour

Applies to SEAM 1

SEAM is easiest to understand from the outside in. A store is a directory; the directory holds files; the data files hold blocks; the blocks hold entries; and every entry is keyed by bytes whose first byte says what it belongs to.

1. A store is one directory keys sealed keyring wal/ write-ahead log MANIFEST live file list data/*.stc SEAM data files caches rebuildable 2. A SEAM file is a run of sealed frames data blocks 0 .. n sorted by key, newest first bloom key filter stats per block index block map footer, 96 B found from the end 3. A data block holds entries, row by row or column by column Row block (format 0) prefix-shared keys, restart points Columnar block (format 1) keys, timestamps, kinds, values as columns 4. Every entry is a key, a timestamp and a value user key bytes, sorted up timestamp newest first kind put or delete value row, index, ... first key byte 0x00 catalog 0x01 rows 0x02 index 0x04 postings The same four steps, in order, are the structure of this wiki.
The four levels of a SEAM store. Each box is explained on its own page in this wiki.
  1. The store directory. One directory per database holds the sealed keyring keys, the write-ahead log under wal/, the MANIFEST and the data files under data/, and a few rebuildable caches. See Store layout.

  2. The data file. A .stc file is a run of sealed frames: data blocks, then a bloom filter, an optional stats frame, a block index, and a 96-byte footer at the very end. A reader starts from the footer. See SEAM data file.

  3. The block. Each data block stores the same entries either row by row (row block) or column by column (columnar block, using the column codecs). A frame wraps the block with a one-byte codec and format header, optional zstd or LZ4 compression, and the seal trailer.

  4. The key. Entries are (user key, timestamp, kind, value). The first byte of the user key picks the owner: the catalog, table rows, index entries, or postings. See the keyspace map.

To read the value of a key at a timestamp, a reader does this.

  1. Open the footer: authenticate it, check the magic and revision, and learn where the bloom filter and index live.
  2. Ask the bloom filter whether the key can be in the file. A “no” ends the search in this file.
  3. Binary-search the block index for the first block whose last key is not less than the wanted (user key, timestamp).
  4. Read that frame, authenticate it with its AAD, decompress it, and decode the block.
  5. Within the block, find the newest entry for the user key whose timestamp is at or below the read timestamp. A tombstone hides older versions.

Writers do the mirror image: records go to the WAL first, are flushed into new data files, and a MANIFEST edit makes the new files live in one durable step.

If you want to Read
Parse a store from scratch Open sequence, then Reader checklist
Understand the encryption Encryption at rest
Decode a data file by hand Hex walk-through
See what changed between formats Version matrix and Compare versions
Look up a term Glossary