Expand description
Dynamic stream controls and attachment points modeled after Akka Streams.
KillSwitches expose reusable shutdown/abort controls for already-wired streams without
starting any work before materialization.
The hub stages materialize reusable attachment points:
MergeHubmaterializes aSinkthat many producers can attach to over time.BroadcastHubmaterializes aSourcethat many consumers can attach to over time.PartitionHubmaterializes aSourcewhose elements are routed to one selected consumer.
BroadcastHub and PartitionHub follow Akka’s caveat that one upstream producer adapts to the
slowest active consumer unless callers add their own buffering or drop stages around the
materialized consumer sources.
Datum’s BroadcastHub differs from Akka when there are zero attached consumers: Datum blocks
upstream immediately, while Akka may pre-buffer up to buffer_size elements before stalling.
Structs§
- Broadcast
Hub - Fan-out attachment point: materializes a reusable source that many consumers attach to over
time, where every consumer receives every element. See
BroadcastHub::sink. - Broadcast
HubConsumer Source - Materialized value of
BroadcastHub::sink.Clone; callBroadcastHubConsumerSource::sourceto obtain a fresh consumerSourceblueprint for each consumer that attaches. - Kill
Switches - Factory for the
UniqueKillSwitchandSharedKillSwitchstream controls. - Merge
Hub - Fan-in attachment point: materializes a reusable
Sinkthat many producers attach to over time, feeding one running downstream. SeeMergeHub::source/MergeHub::source_with_draining. - Merge
HubDraining Control - Control returned by
MergeHub::source_with_drainingthat stops accepting new producers and completes the hub once the currently attached producers finish. - Partition
Consumer Info - Snapshot of the currently attached consumers handed to a
PartitionHubpartitioner. The partitioner returns aconsumer_id(isize) to route to, or-1to drop the element. - Partition
Hub - Fan-out attachment point that routes each element to exactly one selected consumer (or drops it),
chosen by a user partitioner. See
PartitionHub::sink. - Partition
HubConsumer Source - Materialized value of
PartitionHub::sink.Clone; callPartitionHubConsumerSource::sourceto obtain a fresh consumerSourceblueprint for each consumer that attaches. - Shared
Kill Switch - A named, cloneable kill switch shared across any number of streams.
- Unique
Kill Switch - An exclusive shutdown/abort handle for one materialized stream.