Trait reactive_messaging::prelude::ChannelMulti
source · pub trait ChannelMulti<'a, ItemType, DerivedItemType>where
ItemType: Debug + Send + Sync,
DerivedItemType: Debug,{
// Required methods
fn create_stream_for_old_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
where Self: ChannelConsumer<'a, DerivedItemType>;
fn create_stream_for_new_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
where Self: ChannelConsumer<'a, DerivedItemType>;
fn create_streams_for_old_and_new_events(
self: &Arc<Self>
) -> ((MutinyStream<'a, ItemType, Self, DerivedItemType>, u32), (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32))
where Self: ChannelConsumer<'a, DerivedItemType>;
fn create_stream_for_old_and_new_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)
where Self: ChannelConsumer<'a, DerivedItemType>;
}Expand description
Defines abstractions specific to [Uni] channels
Required Methods§
sourcefn create_stream_for_old_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)where
Self: ChannelConsumer<'a, DerivedItemType>,
fn create_stream_for_old_events( self: &Arc<Self> ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)where Self: ChannelConsumer<'a, DerivedItemType>,
Implemented only for a few [Multi] channels, returns a Stream (and its stream_id) able to receive elements
that were sent through this channel before the call to this method.
It is up to each implementor to define how back in the past those events may go, but it is known that mmap log
based channels are able to see all past events.
If called more than once, every stream will see all the past events available.
Currently panics if called more times than allowed by [Multi]’s MAX_STREAMS
sourcefn create_stream_for_new_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)where
Self: ChannelConsumer<'a, DerivedItemType>,
fn create_stream_for_new_events( self: &Arc<Self> ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)where Self: ChannelConsumer<'a, DerivedItemType>,
Returns a Stream (and its stream_id) able to receive elements sent through this channel after the call to this method.
If called more than once, each Stream will see all new elements – “listener pattern”.
Currently panics if called more times than allowed by [Multi]’s MAX_STREAMS
sourcefn create_streams_for_old_and_new_events(
self: &Arc<Self>
) -> ((MutinyStream<'a, ItemType, Self, DerivedItemType>, u32), (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32))where
Self: ChannelConsumer<'a, DerivedItemType>,
fn create_streams_for_old_and_new_events( self: &Arc<Self> ) -> ((MutinyStream<'a, ItemType, Self, DerivedItemType>, u32), (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32))where Self: ChannelConsumer<'a, DerivedItemType>,
Implemented only for a few [Multi] channels, returns two Streams (and their stream_ids):
- one for the past events (that, once exhausted, won’t see any of the forthcoming events)
- another for the forthcoming events.
The split is guaranteed not to miss any events: no events will be lost between the last of the “past” and
the first of the “forthcoming” events.
It is up to each implementor to define how back in the past those events may go, but it is known thatmmap logbased channels are able to see all past events.
If called more than once, every stream will see all the past events available, as well as all future events after this method call.
Currentlypanics if called more times than allowed by [Multi]’sMAX_STREAMS
sourcefn create_stream_for_old_and_new_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)where
Self: ChannelConsumer<'a, DerivedItemType>,
fn create_stream_for_old_and_new_events( self: &Arc<Self> ) -> (MutinyStream<'a, ItemType, Self, DerivedItemType>, u32)where Self: ChannelConsumer<'a, DerivedItemType>,
Implemented only for a few [Multi] channels, returns a single Stream (and its stream_id) able to receive elements
that were sent through this channel either before and after the call to this method.
It is up to each implementor to define how back in the past those events may go, but it is known that mmap log
based channels are able to see all past events.
Notice that, with this method, there is no way of discriminating where the “old” events end and where the “new” events start.
If called more than once, every stream will see all the past events available, as well as all future events after this method call.
Currently panics if called more times than allowed by [Multi]’s MAX_STREAMS