Expand description
Backend-trait supporting types (RFC-012 Stage 0).
This module carries the public types referenced by the EngineBackend
trait signatures in RFC-012 §3.3. The trait itself lands in Stage 1
(issue #89 follow-up); Stage 0 is strictly type-plumbing and the
ResumeSignal crate move.
Public structs/enums whose fields or variants are expected to grow
are marked #[non_exhaustive] per project convention — consumers
must write _-terminated matches and use the provided constructors
rather than struct literals. Exceptions:
- Opaque single-field wrapper newtypes (
HandleOpaque,WaitpointHmac) hide their inner field and need no non-exhaustive annotation — the wrapped value is unreachable from outside. ResumeSignalis intentionally NOT#[non_exhaustive]so the ff-sdk crate-move (Stage 0) preserves struct-literal compatibility at its existing call site.
See rfcs/RFC-012-engine-backend-trait.md §3.3.0 for the authoritative
type inventory and §4.1-§4.2 for the Handle / EngineError shapes.
Structs§
- Backend
Config - Configuration passed to
ValkeyBackend::connect(and, later, to other backendconnectconstructors). Carries the connection details + shared timing/retry policy. Replaces the Valkey-specific fields today onWorkerConfig(RFC-012 §5.1 migration plan). - Backend
Retry - Retry policy shared across backend connections. Additive; Stage 1a ships the minimal shape so the trait signatures can reference it.
- Backend
Timeouts - Pool + keepalive timing shared across backend connections.
- Capability
Set - Worker capability set — the tokens the worker advertises to the
scheduler and to
claim. Today stored asVec<String>onWorkerConfig; promoted to a named newtype so the trait signatures can talk about capabilities without committing to a concrete container shape. - Claim
Policy - Policy hints for
claim. Minimal at Stage 0 per RFC-012 §3.3.0 (“Bikeshed-prone; keep minimal at Stage 0”). Future fields (retry count, fairness hints) land additively. - Completion
Payload - One completion event delivered through the
CompletionStream(RFC-012 §4.3). Also the payload type for issue #90’s subscription API. Stage 0 authorises the type; issue #90 fixes the wire shape. - Failure
Reason - Human-readable failure description + optional structured detail.
Replaces today’s ad-hoc string arg to
fail. - Frame
- Single stream frame appended via
append_frame(RFC-012 §3.3.0). Today’s FCALL takes the byte payload + frame_type + optional seq as discrete ARGV; Stage 0 collects them into a named type for trait signatures. - Handle
- Opaque attempt cookie held by the worker for the duration of an
attempt. Produced by
claim/claim_from_reclaim/suspend; borrowed by every op (renew, progress, append_frame, complete, fail, cancel, suspend, delay, wait_children, observe_signals, report_usage). - Handle
Opaque - Backend-private opaque payload carried inside a
Handle. - Lease
Renewal - Result of a successful
renewcall. - Reclaim
Token - Opaque cookie returned by the reclaim scanner; consumed by
claim_from_reclaimto mint a resumed Handle. - Resume
Signal - Signal that satisfied a waitpoint matcher and is therefore part of
the reason an execution resumed. Returned by
observe_signals(RFC-012 §3.1.2) and byClaimedTask::resume_signalsin ff-sdk. - Scanner
Filter - Per-consumer filter applied by FlowFabric’s background scanners and completion subscribers so multiple FlowFabric instances sharing a single Valkey keyspace can operate on disjoint subsets of executions without mutual interference (issue #122).
- Usage
Dimensions - Usage report for
report_usage. Mirrors today’sff_report_usage_and_checkARGV: token-counts, wall-time, custom dimensions. - Valkey
Connection - Valkey-specific connection parameters.
- Waitpoint
Hmac - HMAC token that binds a waitpoint to its mint-time identity. Wire
shape
kid:40hex. - Waitpoint
Spec - One waitpoint inside a suspend request.
suspendtakes aVec<WaitpointSpec>; the resume condition (any/all) lives on the enclosing suspend args in the Phase-1 contract.
Enums§
- Admission
Decision - Admission outcome returned by
report_usage. - Backend
Connection - Discriminated union over per-backend connection shapes. Stage 1a
ships the Valkey arm; future backends (Postgres) land additively
under the
#[non_exhaustive]guard. - Backend
Tag - Backend-tag discriminator embedded in every
Handleso ops can dispatch to the correct backend implementation at runtime. - Cancel
Flow Policy - Cancel-flow policy — what to do with the flow’s members. Today
encoded as a
StringonCancelFlowArgs; Stage 0 extracts the policy shape as a typed enum (RFC-012 §3.3.0). - Cancel
Flow Wait - Caller wait posture for
cancel_flow. - Fail
Outcome - Outcome of a
fail()call. - Failure
Class - Failure classification — determines retry disposition on the Lua side. Mirrors the Lua-side classification codes.
- Frame
Kind - Frame classification for
append_frame. Mirrors the Lua-sideff_append_frameframe_typeARGV. - Handle
Kind - Lifecycle kind carried inside a
Handle. Backends validatekindon entry to each op and returnEngineError::Stateon mismatch. - Waitpoint
Kind - Waitpoint matcher mode (mirrors today’s suspend/close matcher kinds — signal name, correlation id, etc.).