Skip to main content

Module stream

Module stream 

Source
Expand description

Chunked transfers over ordinary edges (blueprint §9.4, session_id/segment_id/seq/fin/flush).

  session S ┬─ segment 0 ─ seq 0,1,2 … fin        (one point cloud)
            ├─ segment 1 ─ seq 0,1 … fin          (the next one)
            └─ segment 2 ─ seq 0 … flush … fin    (a partial delivery)

Three keys, three jobs: session_id says which conversation, segment_id says which message within it, seq says which chunk within that message. fin ends a segment; flush asks the receiver to deliver what it has without ending anything.

§Why a node needs help here

A chunked transfer has three failure modes that a bare metadata key cannot prevent, and StreamAssembler detects all three:

FailureHow it is caught
A gap (chunk 3 arrives after chunk 1)The assembler expects seq to be contiguous and reports crate::NodeError::Pattern
ReorderingSame check; out-of-order is a gap from the assembler’s side
A segment that never endsStreamAssembler::open_segments shows it; a node with a deadline can act

Correlated messages are not eviction-immune here — a stream chunk carries none of §11.2’s correlation keys — which is deliberate: a stream that outruns its consumer should drop, and the assembler will say so at the gap rather than silently reassembling the wrong bytes.

Structs§

ChunkRef
One chunk’s place in its stream.
StreamAssembler
The receiving side of a stream (§9.4).
StreamSegment
A completed segment, reassembled.
StreamWriter
The sending side of a stream (§9.4).

Functions§

chunk_bytes
The payload bytes of an event, for a caller assembling by hand.

Type Aliases§

AcceptedChunk
What StreamAssembler::accept_event made of an event: a completed segment, a chunk it absorbed (Ok(None)), or the event handed back because it was not a stream chunk at all.