Module journal
Expand description
The journal generator: docs/reference/journal-format.md from the record
types and the committed byte golden.
The on-disk format has two registries, and this page is both of them (§7):
- the types.
crates/atune_core/src/storage/journal/record.rsdeclaresHeader,OpRecordand theOpenum, one variant per mutatingStoragemethod. Their serde attributes are the wire names —#[serde(tag = "kind", rename_all = "kebab-case")]is why a report line says"kind":"report"— so the generator reads the attributes rather than a table of names somebody kept in step by hand. Asynparse for the same reason theerrorsgenerator needs one: a serde attribute is compile-time, and nothing at run time can hand back the rule rather than one instance of its result. - the bytes.
crates/atune_core/tests/goldens/journal_full_study_v{N}.jsonlis a whole study’s journal, byte-pinned by a test that replays it back to the study that produced it. It is the worked example, quoted verbatim: a hand-written sample would be a fourth copy of the format, and the one thing a reader wants from a format reference is a file they can trust byte for byte.
Two fail-closed checks tie the two together. The golden’s own header must carry
the FORMAT_VERSION the code writes — a page cannot show a v1 file as an
example of a v2 format — and every kind in the golden must be a variant the
enum declares, so the example can never contain a line the table above it does
not explain.
Structs§
- Journal
Format - Generates the journal-format reference page.
- Operation 🔒
- One
Opvariant: its wire tag, its payload and its documentation.
Constants§
- BLESS 🔒
- The command that regenerates the golden, for the page to cite.
- GENERATOR 🔒
- This generator’s name, for fail-closed error messages.
- GOLDENS 🔒
- The directory the byte goldens live in.
- SOURCE 🔒
- The file that owns the record format.
Functions§
- field_
of 🔒 - The value of a top-level JSON field, as written.
- format_
version 🔒 - The
FORMAT_VERSIONthe code writes. - kebab_
case 🔒 - Serde’s
rename_all = "kebab-case"applied to a variant name. - named_
struct 🔒 - The struct
name, which must have named fields. - operation_
kind 🔒 - The
kindof an operation line. - operations 🔒
- The
Opvariants, in declaration order, with their wire tags. - render_
envelope 🔒 - Writes the two line shapes and their common envelope.
- render_
fields 🔒 - Writes one struct’s fields as a definition list of code spans.
- render_
floats 🔒 - Republishes the module’s own explanation of the non-finite float encoding.
- render_
golden 🔒 - Quotes the committed byte golden, and checks it against the types above.
- render_
operations 🔒 - Writes the operation catalogue.
- require_
serde 🔒 - Requires the enum to be internally tagged on
tag, and kebab-cased. - serde_
arguments 🔒 - The arguments of every
#[serde(…)]attribute on an item, as written.