Skip to main content

Module projections

Module projections 

Source
Expand description

Read-side helpers for projection files.

Each read_* here reads exactly one file and is coherent on its own (atomic rename — see crate::atomic). A caller that reads several files as one logical view (e.g. manifest.json together with the nodes/, discussions/, or spinoffs/ projection set, whose denormalized counters the reducer updates in the same locked mutation) must wrap the whole scan in crate::RunLock::with_shared_lock (LOCK_SH). That excludes the reducer’s exclusive lock for the scan’s duration, so the reader observes one committed snapshot rather than a half-applied update (design.md §4). The lock is released before the result is serialized.

Functions§

read_discussion
Read and schema-validate one discussion. Errors if it is missing.
read_discussion_opt
Read and schema-validate one discussion, returning None if absent.
read_manifest
Read and schema-validate the run manifest. Errors if it is missing.
read_manifest_opt
Read and schema-validate the run manifest, returning None if absent.
read_node
Read and schema-validate one node. Errors if it is missing.
read_node_opt
Read and schema-validate one node, returning None if absent.
read_spinoff
Read and schema-validate one spin-off proposal. Errors if it is missing.
read_spinoff_opt
Read and schema-validate one spin-off proposal, returning None if absent.
write_node
Atomically write a node’s projection file, keyed by its node_id.