Expand description
The pure lifecycle state machine every Registry backend composes over.
This is the single source of the pact lifecycle semantics — the claim-eligibility predicate, the state transitions, the current-holder authority check, and the lease arithmetic. A backend owns its own storage and mints its own retainer (a fencing value); it delegates every eligibility decision and transition here, so the semantics are defined once and cannot drift between backends (or between a synchronous and a future asynchronous binding).
It is colorless and sans-I/O: it reads no clock (time is an injected parameter),
performs no I/O, and mints nothing non-deterministic (the retainer is supplied by the
caller). Named lifecycle to distinguish it from the executor step-driver
kernel, which is a different pure machine.
Structs§
- NotCurrent
Holder - A transition was attempted by something that is not the state’s current holder — a stale retainer, or a state (available, deferred, settled) with no holder at all.
Enums§
- State
- A pact’s position in its claim lifecycle: the pure state a backend maps to its own storage. The backend owns where it lives; this owns what it means.
Functions§
- is_
claimable - Whether a pact in
statemay be claimed atnow: the eligibility invariant.Availablealways; aHeldlease that has lapsed; aDeferredpact at or past its instant; never aSettledone. Only positive, unambiguous eligibility. - lease_
expiry - The lease expiry for a claim taken at
nowforlease_millis— the single source of the lease arithmetic. - on_
claim - The state a successful claim produces:
Heldbyretaineruntil the lease expiry fornow/lease_millis. The backend mintsretainerand passes it in. - on_
heartbeat - The state a heartbeat produces: the lease extended to the expiry for
now/lease_millis, providedretainercurrently holdsstateand the lease has not already lapsed. A lapsed lease is not revived — the holder must re-claim. - on_
release - The state a release produces:
Deferreduntilreclaimable_at, providedretainercurrently holdsstate. Non-terminal; rotates authority away. - on_
settle - The state a settlement produces:
Settled, providedretainercurrently holdsstate. Fulfill and breach share this — the lifecycle state records that the obligation concluded, not which outcome concluded it.