Skip to main content

StreamMetadata

Trait StreamMetadata 

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

Source

fn stream_id(&self) -> StreamId

Source

fn local_node_id(&self) -> NodeId

Source

fn origin_node_id(&self) -> &GlobalNodeId

Source

fn num_consumers(&self) -> usize

Source

fn clear_consumer_count(&self)

Resets consumer count to 0.

Source

fn register_consumer(&self)

Invoked by the scheduler exactly once for each consumer operator attached to the stream.

Source

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".

Implementors§

Source§

impl<C, D> StreamMetadata for Stream<C, D>
where C: Clone + 'static, D: 'static,