Skip to main content

Module workloop

Module workloop 

Source
Expand description

Durable workloop records and persistence contract. Durable workloop records and persistence contract (workloop brief Leg 2).

Two record families:

  • WorkloopRecord — one per registered loop: the declared [WorkloopSpec], the engine’s cadence bookkeeping (window sequence, next window, next check), and per-invariant health accounting. A sleeping loop IS this record plus its event history — no resident process, no scheduler presence (R13.3). The cadence sweeper drives itself off WorkloopStore::due_workloops.
  • InvariantStateRecord — the current-state record of one invariant (R7): a store document of its declared type, type-erased here as a Payload plus the declared type name. Exactly one CURRENT record per invariant survives indefinitely; prior generations are retention-bounded on the loop’s declared window (R8.1) and live in the same single-key slot so every mutation is one atomic value swap on any backend.

Structs§

InvariantHealthState
Per-invariant health accounting the engine persists between sweeps.
InvariantRecordSlot
The single-key slot holding one invariant’s CURRENT record plus its retention-bounded prior generations (oldest first).
InvariantStateRecord
The current-state record of one invariant (R7): a store document of the invariant’s declared type, type-erased as payload bytes + type name.
UndecodableWorkloop
A workloop row that was present but could not be decoded.
WorkloopDueProbe
The one field the due sweep filters on, decodable WITHOUT validating the whole record: a thousand sleeping loops must cost the sweeper a comparison each, not a full spec re-validation each (the R13.3 measurement is what caught the difference — ~20µs per full decode versus nanoseconds per comparison).
WorkloopListing
Complete workloop listing, including poisoned-row visibility.
WorkloopRecord
One durable workloop registration: the declared spec plus the engine’s cadence and health bookkeeping.

Traits§

WorkloopStore
Durable workloop persistence contract.