pub trait StreamMetadata: DynClone + 'static {
// Required methods
fn stream_id(&self) -> StreamId;
fn local_node_id(&self) -> NodeId;
fn origin_node_id(&self) -> &GlobalNodeId;
fn num_consumers(&self) -> usize;
fn clear_consumer_count(&self);
fn register_consumer(&self);
fn consume_token(&self);
}Expand description
An object-safe interface to a stream.
The Stream type is parameterized with circuit and content types, and is not object-safe.
This abstract trait abstracts away those types, allowing to pass streams around as trait objects.
Required Methods§
fn stream_id(&self) -> StreamId
fn local_node_id(&self) -> NodeId
fn origin_node_id(&self) -> &GlobalNodeId
fn num_consumers(&self) -> usize
Sourcefn clear_consumer_count(&self)
fn clear_consumer_count(&self)
Resets consumer count to 0.
Sourcefn register_consumer(&self)
fn register_consumer(&self)
Invoked by the scheduler exactly once for each consumer operator attached to the stream.
Sourcefn consume_token(&self)
fn consume_token(&self)
Invoked at each step once by each consumer of the stream.
When the token count drops to 1, the last consumer can retrieve the value using
StreamValue::take.
Panics if called more times than there are tokens.
All tokens must be consumed at each step; otherwise the circuit will panic during the next step.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".