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
- Checkpoint
Run - One loaded run in a checkpoint.
Enums§
- Entry
Ref - A store entry with borrowed parts, encoded by
encode_entry_intowithout copying them into aStoreEntryfirst. - Store
Entry
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
Deltachain may have before its journal is written whole. - STORE_
FORMAT - Format 3 adds
DeltaandIndexentries. 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
Deltaextends withread. 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
ParkorDoneentry follows the entry metadata. - encode_
entry_ into - Appends one framed entry to
out: the bytesencode_entryreturns, written in place. - journal_
done - A finished run’s status and end time when
journal(canonical records) ends with itsDonerecord: aDeltaframe that finishes a run that was loaded from its stored frames. - read_
entry - Reads the single entry at
blob(as returned byscan_store). - read_
whole_ journal - The run, last LSN and journal of a
ParkorDoneframe, borrowed fromframeand checked asread_entrychecks it;Nonefor other entries (aDeltaneedschain_journal). - scan_
store - Reads entries from
bytes(a run store prefix, header included), callingvisit(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.