Skip to main content

Module dynamic

Module dynamic 

Source
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:

  • MergeHub materializes a Sink that many producers can attach to over time.
  • BroadcastHub materializes a Source that many consumers can attach to over time.
  • PartitionHub materializes a Source whose 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§

BroadcastHub
Fan-out attachment point: materializes a reusable source that many consumers attach to over time, where every consumer receives every element. See BroadcastHub::sink.
BroadcastHubConsumerSource
Materialized value of BroadcastHub::sink. Clone; call BroadcastHubConsumerSource::source to obtain a fresh consumer Source blueprint for each consumer that attaches.
KillSwitches
Factory for the UniqueKillSwitch and SharedKillSwitch stream controls.
MergeHub
Fan-in attachment point: materializes a reusable Sink that many producers attach to over time, feeding one running downstream. See MergeHub::source / MergeHub::source_with_draining.
MergeHubDrainingControl
Control returned by MergeHub::source_with_draining that stops accepting new producers and completes the hub once the currently attached producers finish.
PartitionConsumerInfo
Snapshot of the currently attached consumers handed to a PartitionHub partitioner. The partitioner returns a consumer_id (isize) to route to, or -1 to drop the element.
PartitionHub
Fan-out attachment point that routes each element to exactly one selected consumer (or drops it), chosen by a user partitioner. See PartitionHub::sink.
PartitionHubConsumerSource
Materialized value of PartitionHub::sink. Clone; call PartitionHubConsumerSource::source to obtain a fresh consumer Source blueprint for each consumer that attaches.
SharedKillSwitch
A named, cloneable kill switch shared across any number of streams.
UniqueKillSwitch
An exclusive shutdown/abort handle for one materialized stream.