Expand description
Durable run records for hosts that serve many runs (an HTTP server, a job queue).
A RunStore keeps, per run: a RunRecord (status, outputs, pause
reasons…), the run’s events as JSON, and the Snapshot of a paused run, so
a run can be resumed by id after the client went away or the host restarted.
Nothing secret is persisted: event values serialize with secrets masked, and
snapshots never contain secret plaintext (see crate::snapshot).
§Writes that can be retried
A host that writes through a network (a gateway in front of agents, an object store) must be able to retry any write without corrupting the run:
RunStore::append_eventstakes the index of the first event of the batch. A batch that is already stored (a retry after a lost reply) is accepted without storing it twice; a batch that would leave a gap, or that differs from the events already stored at those indices, is refused.RunStore::put_ifreplaces a record only while itsRunRecord::epochis still the expected one, so a stale writer (a zombie replica, an execution that was taken over) cannot overwrite a newer one.- Every claim (
RunStore::claim_resume,RunStore::claim_dispatch) increments the epoch.
Structs§
- Append
Plan - How a batch passed to
RunStore::append_eventslines up with the events a store already holds (shared by implementations). - RunFilter
- Query for
RunStore::list. - RunPage
- One page of
RunStore::list, newest first. - RunRecord
- Persisted summary of one run.
Enums§
- RunStatus
- Lifecycle status of a stored run.
- Store
Error - Store failure.
Constants§
- INTERRUPTED_
BY_ RESTART - Error message stored on runs interrupted by a host restart.
Traits§
- RunStore
- Durable storage of run records, events and snapshots.
Functions§
- append_
mismatch StoreError::Conflictfor a retried event that differs from the stored one.- check_
epoch StoreError::Preconditionunlessrecordis atexpected_epoch.- event_
to_ json - Serialize an event for storage. Secrets are masked by the value serializer; the
snapshot carried by
run_pausedis dropped (stores keep it separately). - event_
to_ stored - Serialize an event for storage: the same JSON as
event_to_json, written straight to text. - now_ms
- Current Unix time in milliseconds (0 where no clock exists).
- page_of
- Apply
filterto records already sorted newest first (shared by implementations). - plan_
append - Plan an append of
batch_lenevents atfirst_indexto a run holdingevent_countevents. Fails withStoreError::Conflicton a gap. - sort_
newest_ first - Sort records newest first (ties broken by id, descending) for
page_of. - stored_
event_ type - The
typefield of a stored event (e.g.node_started), if it has one. - validate_
run_ id - Validate a run id used as a storage key: 1–128 chars of
[A-Za-z0-9_.-], not starting with..
Type Aliases§
- Store
Result - Result type of
RunStoreoperations. - Stored
Event - An event serialized as one JSON object, the form in which stores keep events.