pub enum ClaimLoopState {
Idle,
ChainSourceUnavailable,
PersistedStateCorrupt,
CadenceNotElapsed,
Faulted {
cycles: u64,
},
ClaimableButNotClaiming {
claimable: u64,
submitted: u64,
},
Nominal,
}Expand description
The claim loop’s own condition, as the loop last reported it — a closed
set of seven members (SPEC §4.4.3). ClaimLoopState mirrors the producer’s
enumeration one-to-one, payloads included: a wire type with fewer states
than the loop can be in is a new instance of the defect this method exists
to remove, a type that cannot say something went wrong.
The tag key is kind, not state — the field holding this type is already
named state, and "state": { "state": … } would put two meanings under
one key in adjacent positions.
ClaimableButNotClaiming is the state a
conforming producer reports whenever claims exist that the loop did not
make and no cycle-wide fault is live — the anti-silence signal this
method exists to carry. It is never folded into
Nominal for lack of anywhere else to go, and a
cycle-wide fault is never folded into it either.
The five payload-less members (Idle,
ChainSourceUnavailable,
PersistedStateCorrupt,
CadenceNotElapsed, Nominal)
serialise as exactly { "kind": … }. serde does not apply
deny_unknown_fields to the payload-less members of an internally tagged
enum, so { "kind": "idle", "claimable": 5 } parses as Idle with the
stray key silently dropped (SPEC §4.4.1’s one stated vacuity) — a
conforming producer never emits the stray key, and a consumer MUST NOT
read any key but kind from a payload-less state. The property this type
does enforce is the one that carries weight: the counts a reader acts on
live on ClaimLoopObservation::Consulted, where unknown and missing
keys ARE rejected.
Not #[non_exhaustive], on purpose: a wildcard arm in a consumer is
#[serde(other)] relocated to the render path, deciding at compile time
that a state nobody has heard of renders as something bland. A new member
is a SPEC amendment and a breaking release for every consumer.
Variants§
Idle
No cycle has been attempted yet.
The chain seam reported itself unavailable; no cycle ran. The true state, not a silent no-op.
PersistedStateCorrupt
The loop’s persisted claim state was unreadable, unparsable, over its
own budget or future-dated; the loop treats its spend window as
exhausted and submits nothing this cycle. A refusal made visible, not
a freeze that reads as Nominal.
CadenceNotElapsed
The claim cadence has not elapsed since the last completed cycle: a deliberate skip, named as its own condition rather than left as the absence of one.
Faulted
A chain call this cycle failed with a real error, distinct from “no chain at all”.
Fields
ClaimableButNotClaiming
Fewer distributors were claimed against this cycle than should have been, and no fault is live. The anti-silence signal: the loop is running and paying nobody, or not everybody. This is the state reported whenever claims exist and none are being made.
Fields
claimable: u64This cycle’s distributors that should have been claimed against.
A count of distributors, never an amount, and at least
ClaimLoopObservation::Consulted’s own
distributors_claimable — the producer folds in refusals it
never counted as claimable.
Nominal
A cycle completed and none of the above is true.
Trait Implementations§
Source§impl Clone for ClaimLoopState
impl Clone for ClaimLoopState
Source§fn clone(&self) -> ClaimLoopState
fn clone(&self) -> ClaimLoopState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more