Expand description
Dialect-independent queued-work claim logic shared by durable backends.
The SQL backends (sqlite, postgres) load candidate batch rows ordered by
enqueue_seq and pre-filtered to ready batches that are not held by a
live claim, then apply the same pure state machine: a delivery-policy
boundary gate, slot-policy/merge-key prefix grouping, and fencing-token /
lease derivation. That state machine lives here so the backends own only
their SQL reads and writes while the claim contract has a single
implementation, exercised against every backend by the shared
runtime_persistence conformance suite.
Structs§
- Claim
Candidate - Decoded claim-relevant fields of one ready queued-work batch row.
- Queued
Work Claim Lease - A freshly derived lease for a selected claim prefix.
Functions§
- claim_
scan_ limit - How many candidate rows a backend should scan when selecting up to
max_batchesclaimable batches. Joinable groups are matched as a prefix, so scanning a bounded surplus keeps one round trip sufficient. - derive_
batch_ id - Derive the durable id for a newly enqueued batch.
- ensure_
completion_ owns_ all_ batches - Apply the shared completion-fencing decision: a completion may delete its
batches only when the live store still shows the claim owning every one
of them (
owned_rowsrows matched the claim id + lease token). - renewed_
claim - Apply the shared lease-renewal decision: the lease holds only when every batch row in the claim accepted the new expiry stamp.
- select_
claim_ prefix - Select the prefix of
candidatesthat a single claim may take.