Skip to main content

Module streaming

Module streaming 

Source
Expand description

Streaming helpers for the caller-wraps architecture

These functions are used by the DynamicHub routing layer to wrap activation responses with metadata. Activations return typed domain events, and the caller uses these helpers to create PlexusStreamItems.

Functions§

create_bidir_stream
Create a bidirectional channel and wrap a stream, merging Request items
done_stream
Create a done stream
error_stream
Create an error stream
progress_stream
Create a progress stream
wrap_one
-> T: one data frame carrying item, then done.
wrap_one_result
-> Result<T, E>: one data frame, {"ok": t} or {"err": e}, then done.
wrap_progress_stream
-> impl Stream<Item = Progress<T, P>>: Update(p) → a progress frame carrying p; Item(t) → a data frame carrying t. Then done.
wrap_result_progress_stream
-> impl Stream<Item = Result<Progress<T, P>, E>>: Ok(Update(p)) → a progress frame; Ok(Item(t)) → a data frame {"ok": t}; Err(e) → a data frame {"err": e}. Then done.
wrap_result_stream
-> impl Stream<Item = Result<T, E>>: one data frame per item, {"ok": t} or {"err": e}; an Err does not end the stream. Then done.
wrap_stream
Wrap a typed stream into PlexusStream with automatic Done event
wrap_stream_with_bidir
Wrap a typed stream with bidirectional support

Type Aliases§

PlexusStream
Type alias for boxed stream of PlexusStreamItem