Expand description
CheckpointWriter — append-only event-log owner for the
per-session checkpoint document. SRD-44a §“Writer behaviour”.
Per SRD-44a, every state-changing observation is one event
line written to logs/<session>/checkpoint.jsonl. The writer:
- is created at session bootstrap (or restored from a saved
document on resume) — emits a
session_startevent, - has phases declared into it during pre-map — one
phase_declaredevent each, - receives phase-lifecycle calls (
phase_started,phase_completed,phase_failed) — one event per call, - receives op-count and cursor-state updates from the
metrics tick callback — one
phase_progressevent per tick.
No whole-document rewrite. The file is opened in append mode
(O_APPEND); each event is a single \n-terminated line.
In-memory state is the same Checkpoint document as before
so snapshot() and resume_hint() keep working without
re-folding from disk.
The writer is Send + Sync (interior mutex) so the executor,
the tick callback, and the cursor-state collector can all
hold one Arc<CheckpointWriter>.
Structs§
- Checkpoint
Writer - Writer-side handle to the per-session checkpoint event log.
One instance per session; held as
Arc<CheckpointWriter>and shared between the executor (lifecycle calls) and the metrics tick (count + cursor + flush calls).
Constants§
- CHECKPOINT_
VERSION - On-disk checkpoint version this build emits / accepts. Bump only when an incompatible schema change ships; resume against a different version is rejected at read time.