Skip to main content

Module store

Module store 

Source
Expand description

On-disk JSON persistence + boot reconciliation for workstream records (DOC-48 §3).

Why: the daemon must survive restarts without losing track of which workstreams it owns, or silently changing which one is active (§3.2: “A daemon restart never silently changes which workstream is active”). A single flat JSON file with an atomic temp+rename write gives crash-safe persistence without a database dependency — mirroring trusty_mpm::session_manager::store::SessionStore’s proven pattern (fingerprint-gated reload, atomic write, structured errors), adapted to this spec’s flat-array-plus-pointer shape (§3.1) instead of a keyed map. What: StoreError (structured failure surface), ReconcileOutcome (what boot reconciliation did), and WorkstreamStore — load/save, create/get/list, the low-level set_active persistence primitive (NOT the future workstream.activate RPC verb — see its docs), and WorkstreamStore::reconcile_on_boot (§3.3: non-destructive, restores the active pointer or clears it if the target vanished). Test: store_tests.

Structs§

ReconcileOutcome
What a boot-time reconciliation pass (§3.3) observed and did.
WorkstreamStore
Async, file-backed store for Workstream records (DOC-48 §3).

Enums§

BindError
Typed failure surface for WorkstreamStore::bind_session (issue #3298).
StoreError
Errors that can arise from store I/O or serialization.

Constants§

STORE_VERSION
The version field stamped into every store file (§3.1).