Skip to main content

load_state

Function load_state 

Source
pub fn load_state(
    store: &dyn JournalStore,
    paths: &JournalPaths,
    run_id: &str,
) -> Result<Option<RunState>>
Expand description

Read a run’s current state without locking — the read-only path behind release show.

Prefers the atomically-written manifest.json cache (a torn-free read, and O(1) versus replaying the log); falls back to reducing the authoritative journal.jsonl when the manifest is absent, unparsable, or does not match the run. The cache can lag the log by the last event after a crash between append and manifest write, so this is best-effort for display — a correctness-critical read (resume/reconcile) must go through the locked Journal::open, which always reduces the log.

Returns Ok(None) when the run has neither a usable manifest nor a journal.

§Errors

An invalid run_id, or any store/parse error from read_events.