Skip to main content

read_stream

Function read_stream 

Source
pub async fn read_stream(
    backend: &dyn EngineBackend,
    execution_id: &ExecutionId,
    attempt_index: AttemptIndex,
    from: StreamCursor,
    to: StreamCursor,
    count_limit: u64,
) -> Result<StreamFrames, SdkError>
Expand description

Read frames from a completed or in-flight attempt’s stream.

from / to are StreamCursor values — StreamCursor::Start / StreamCursor::End are equivalent to XRANGE - / +, and StreamCursor::At("<id>") reads from a concrete entry id. count_limit MUST be in 1..=STREAM_READ_HARD_CAP0 returns SdkError::Config.

Returns a StreamFrames including closed_at/closed_reason so consumers know when the producer has finalized the stream. A never-written attempt and an in-progress stream are indistinguishable here — both present as frames=[], closed_at=None.

Intended for consumers (audit, checkpoint replay) that hold a ferriskey client but are not the lease-holding worker — no lease check is performed.

§Head-of-line note

A max-limit XRANGE reply (10_000 frames × ~64 KB each) is a multi-MB reply serialized on one TCP socket. Like tail_stream, calling this on a client that is also serving FCALLs stalls those FCALLs behind the reply. The REST server isolates reads on its tail_client; direct SDK callers should either use a dedicated client OR paginate through smaller count_limit slices.