Skip to main content

Module store

Module store 

Expand description

Formats for the run store and checkpoints.

Run store. An append-only file of checksummed entries. A Park entry holds a suspended run’s whole journal plus its timers, a Delta entry (format 3) the records a run appended since an earlier frame of its own plus its timers, a Done entry a finished run’s start and result, and a Tombstone marks a finished run whose retention ended. Later entries for a run supersede earlier ones (a Delta keeps the frames it extends in use). Index entries (format 3) hold the run table’s persisted index. The store is flushed before each checkpoint; the checkpoint names the length that is valid, and recovery reads only that prefix.

Checkpoint. Taken at log position lsn. It names the run store generation and length, carries each loaded run’s journal (or the part of it not already in the run store), and (format 3) names the Index frames in that prefix that list every parked run. Recovery loads the checkpoint, reads those frames (or, without them, scans the whole prefix), then applies log records after lsn. Log segments wholly at or before lsn can then be deleted.

Structs§

Checkpoint
CheckpointRun
One loaded run in a checkpoint.

Enums§

EntryRef
A store entry with borrowed parts, encoded by encode_entry_into without copying them into a StoreEntry first.
StoreEntry

Constants§

CHECKPOINT_FORMAT
Format 3 adds the persisted index and the obsolete byte count. Format 2 checkpoints still open (recovery then scans the run store).
CHECKPOINT_FORMAT_MIN
CHECKPOINT_MAGIC
MAX_CHAIN
Most frames a Delta chain may have before its journal is written whole.
STORE_FORMAT
Format 3 adds Delta and Index entries. Format 2 stores still open; new entries go only to format 3 stores.
STORE_FORMAT_MIN
STORE_HEADER
STORE_MAGIC

Functions§

chain_journal
A run’s journal from its newest frame, reading the frames a Delta extends with read. Returns the journal (canonical records, oldest first), the frames’ total length and how many frames precede the newest.
check_store_header
decode_entry_body
encode_entry
Encodes one framed entry. Returns the frame; the journal blob of a Park or Done entry follows the entry metadata.
encode_entry_into
Appends one framed entry to out: the bytes encode_entry returns, written in place.
journal_done
A finished run’s status and end time when journal (canonical records) ends with its Done record: a Delta frame that finishes a run that was loaded from its stored frames.
read_entry
Reads the single entry at blob (as returned by scan_store).
read_whole_journal
The run, last LSN and journal of a Park or Done frame, borrowed from frame and checked as read_entry checks it; None for other entries (a Delta needs chain_journal).
scan_store
Reads entries from bytes (a run store prefix, header included), calling visit(offset_of_frame, frame_len, entry). Every byte must be valid: the checkpoint vouches for this prefix having been flushed.
store_format
The format of a run store from its header.
store_header
The run store’s 16-byte file header.