Skip to main content

Module stream

Module stream 

Source
Expand description

Effect.ts-inspired Stream API.

Stream v2 adds a pull contract (poll_next_chunk) while preserving the existing facade. Wave 7: the output side of any crate::coordination::channel::Channel<A, …, …, E, R> is consumed as a stream of A with upstream/read failures crate::ChannelReadError via Stream::from_channel / crate::coordination::channel::Channel::to_stream. Duplex crate::coordination::channel::QueueChannel<A, A, _> uses Stream::from_duplex_queue_channel / crate::coordination::channel::QueueChannel::to_stream with QueueError (call crate::coordination::channel::QueueChannel::shutdown to end a drain). A dedicated incremental StreamState arm is deferred while Stream stays generic over E without a QueueError error channel.

Structs§

Stream
Pull-based async stream of A with error type E and environment R.
StreamChannelFull
Error when send_chunk cannot enqueue because the channel is full and BackpressurePolicy::Fail is in effect.
StreamSender
Producer handle for a Stream built with stream_from_channel / stream_from_channel_with_policy.

Enums§

BackpressureDecision
Concrete action chosen for one enqueue attempt given policy and fill level.
BackpressurePolicy
How stream_from_channel_with_policy behaves when the internal queue is full.

Functions§

backpressure_decision
Maps (policy, queue_len, capacity) to a BackpressureDecision (capacity < 1 treated as 1).
end_stream
Signals end-of-stream to consumers (blocks until accepted when using a blocking queue).
merge_time_bucket
Update the bucket at window_start with f (None if the bucket did not exist yet).
send_chunk
Enqueues a chunk for consumers; may block, drop, or fail per the sender’s policy.
stream_from_channel
stream_from_channel_with_policy with BackpressurePolicy::BoundedBlock.
stream_from_channel_with_policy
Builds a channel-backed stream and sender with explicit BackpressurePolicy.

Type Aliases§

StreamBroadcastFanout
(consumer streams, pump effect) from Stream::broadcast.
StreamV1
Compatibility facade preserving the v1 public stream type name.
TimeBucketMap
Ordered window-start → aggregation state, for time-keyed stream operators (tumbling / sliding).