Expand description
Streaming query support for AmateRS SDK
Provides QueryStream — a bounded, cancellable stream of Rows produced
by a background task. The stream implements futures::Stream so callers
can use standard combinators (map, filter, collect, …).
§Design
-
Backpressure — The producer writes into a bounded
tokio::sync::mpscchannel whose capacity is set byStreamConfig::buffer_size. The producer is forced toawaitonce the channel is full, which naturally throttles generation rate to consumption rate. -
Cancellation — A
tokio_util::sync::CancellationTokenis shared between the consumer and the background producer task. Dropping theQueryStreamcancels the token, and the producer checks it before everysend. -
Lazy — The background task is spawned by
QueryStream; no data is generated untilQueryStreamis polled.
The [spawn_stub_producer] helper is retained as a #[doc(hidden)]
test utility; production code uses the real execute_stream RPC.
Structs§
- Query
Stream - A cancellable, backpressure-aware stream of
Rows from a query. - Row
- A single key-value result row returned from a streaming query.
- RowSender
- A handle used by the background producer task to send rows to the consumer and to detect cancellation.
- Stream
Config - Configuration controlling backpressure and optional timeout for a
QueryStream.