Skip to main content

Module state

Module state 

Source
Expand description

The durable state model (RFC 0025 §3, §5–§7): entity kinds, the manifest, the write-ahead inbox, timers, the checkpoint policy and the restore protocol — one façade (Durable) over a crate::store::Store that the runtime (RFC 0026) is the single writer of.

Every entity is a versioned Envelope under <prefix>/<instance>/<kind>/<id>; Durable::put allocates the next seq per key and treats a CAS conflict on a key it already owns as fatal (a second writer). The manifest indexes the live entities so a store without list can still be restored; it is flushed debounced (store.checkpoint.debounce_ms) and at drain.

Modules§

ulid
A dependency-free ULID (Universally Unique Lexicographically Sortable Identifier): 48-bit ms timestamp + 80 random bits, Crockford base32, 26 chars, monotonic within one process for the same millisecond. Used for inbox events, runs, artifacts, audit records — sortable by time in the store’s list and stable across restarts.

Structs§

Durable
The durability façade: the single writer’s view of the store.
EntityRef
One live entity in the manifest index.
InboxEvent
A write-ahead inbox event (RFC 0025 §5).
Manifest
The instance manifest (RFC 0025 §3.3 manifest).
Policy
The checkpoint policy knobs (store.checkpoint, store.durability, store.on_error).
Restored
What a restore found (RFC 0025 §6).
TimerRecord
A durable timer (RFC 0025 §3.3 timer): an absolute deadline + who owns it.

Enums§

InboxStatus
Kind
The entity kinds (RFC 0025 §3.3).

Functions§

config_digest
The digest of the settings that shaped the durable state (RFC 0033 §3.3): section name → SHA-256 hex of that section’s canonical JSON.
fresh_requested
Whether --fresh was given.
kill_point
A test kill point (RFC test strategy §2): with AGENTD_TEST_KILL_AT=<name> set (debug / internal-mocks builds only), the process SIGKILLs itself here — the chaos suite’s way of dying between two durable writes.
record_config_digest
Record the digest of the configuration this process runs under, for Durable::restore to compare against the manifest’s (RFC 0033 §3.3). First call wins — the configuration is loaded once, before any side effect.
request_fresh
--fresh was given: the next Durable opened in this process starts a new generation instead of resuming (RFC 0033 §3.2).