Skip to main content

Module lifecycle

Module lifecycle 

Source
Expand description

The statement lifecycle state machine: submit -> poll/await -> partition assembly, as a pure, synchronous Mealy machine.

Implements bead fsnow-statement-lifecycle-ofl. The machine holds all the lifecycle logic — status routing, the bounded poll loop, and multi-partition row assembly — but performs no IO: a caller feeds it each response (status class + body bytes) and it returns the next Progress step. That makes the whole flow testable end-to-end against the deterministic, no-socket franken_snowflake_testkit::mock::MockSqlApi without a runtime.

The async glue that pumps this machine against the live franken-snowflake-http transport (and fires the remote cancel endpoint on local cancellation) lives in crate::driver. Gzip partition bodies are decompressed by the transport, so the machine always receives decoded partition bytes.

Structs§

CompletedStatement
The fully-assembled result of a completed statement: the parsed terminal ResultSet (metadata + inline partition-0 rows) plus every row across all fetched partitions, concatenated in partition order.
LifecycleError
A lifecycle-orchestration error (distinct from a protocol timeout/failure, which are Progress::TimedOut / Progress::Failed).
PollPlan
How a 202 handle is polled: how many times, and how long to wait between GETs.
StatementMachine
The pure statement lifecycle driver. Construct with StatementMachine::new, then feed each response with StatementMachine::on_submit / StatementMachine::on_poll / StatementMachine::on_partition.

Enums§

LifecycleErrorCode
Stable LifecycleError classes.
Progress
The next step a caller should take after feeding the machine a response.

Constants§

DEFAULT_PARTITION_CONCURRENCY
Default partition fetch window.
MAX_PARTITION_CONCURRENCY
Largest partition fetch window a caller may request.
MIN_POLL_INTERVAL
Lower bound on the inter-poll wait so a 202 poll loop can never degrade into a tight, API-hammering spin (which would also burn the whole poll quota in milliseconds and provoke server-side 429 rate limiting).

Functions§

parse_partition_rows
Decode a non-inline partition body: a bare JSON array of rows.