Trait ChannelCommon

Source
pub trait ChannelCommon<ItemType, DerivedItemType>
where ItemType: Debug + Send + Sync, DerivedItemType: Debug,
{ // Required methods fn new<IntoString>(name: IntoString) -> Arc<Self> where IntoString: Into<String>; fn flush(&self, timeout: Duration) -> impl Future<Output = u32> + Send; fn is_channel_open(&self) -> bool; fn gracefully_end_stream( &self, stream_id: u32, timeout: Duration, ) -> impl Future<Output = bool> + Send; fn gracefully_end_all_streams( &self, timeout: Duration, ) -> impl Future<Output = u32> + Send; fn cancel_all_streams(&self); fn running_streams_count(&self) -> u32; fn pending_items_count(&self) -> u32; fn buffer_size(&self) -> u32; }
Expand description

Defines common abstractions on how [Uni]s receives produced events and delivers them to Streams.
Implementors should also implement one of ChannelProducer or [UniZeroCopyChannel]. NOTE: all async functions are out of the hot path, so the async_trait won’t impose performance penalties

Required Methods§

Source

fn new<IntoString>(name: IntoString) -> Arc<Self>
where IntoString: Into<String>,

Creates a new instance of this channel, to be referred to (in logs) as name

Source

fn flush(&self, timeout: Duration) -> impl Future<Output = u32> + Send

Waits until all pending items are taken from this channel, up until timeout elapses.
Returns the number of still unconsumed items – which is 0 if it was not interrupted by the timeout

Source

fn is_channel_open(&self) -> bool

Tells weather this channel is still enabled to process elements (true before calling the “end stream” / “cancel stream” functions)

Source

fn gracefully_end_stream( &self, stream_id: u32, timeout: Duration, ) -> impl Future<Output = bool> + Send

Flushes & signals that the given stream_id should cease its activities when there are no more elements left to process, waiting for the operation to complete for up to timeout.
Returns true if the stream ended within the given timeout or false if it is still processing elements.

Source

fn gracefully_end_all_streams( &self, timeout: Duration, ) -> impl Future<Output = u32> + Send

Flushes & signals that all streams should cease their activities when there are no more elements left to process, waiting for the operation to complete for up to timeout.
Returns the number of un-ended streams – which is 0 if it was not interrupted by the timeout

Source

fn cancel_all_streams(&self)

Sends a signal to all streams, urging them to cease their operations.
In opposition to [end_all_streams()], this method does not wait for any confirmation, nor cares if there are remaining elements to be processed.

Source

fn running_streams_count(&self) -> u32

Informs the caller how many active streams are currently managed by this channel IMPLEMENTORS: #[inline(always)]

Source

fn pending_items_count(&self) -> u32

Tells how many events are waiting to be taken out of this channel.
IMPLEMENTORS: #[inline(always)]

Source

fn buffer_size(&self) -> u32

Tells how many events may be produced ahead of the consumers.
IMPLEMENTORS: #[inline(always)]

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, OgreArc<ItemType, OgreAllocatorType>> for reactive_mutiny::multi::channels::ogre_arc::atomic::Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: BoundedOgreAllocator<ItemType> + 'a + Sync + Send,

Source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, OgreArc<ItemType, OgreAllocatorType>> for reactive_mutiny::multi::channels::ogre_arc::full_sync::FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Send + Sync + Debug + 'a, OgreAllocatorType: BoundedOgreAllocator<ItemType> + 'a + Sync + Send,

Source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, OgreUnique<ItemType, OgreAllocatorType>> for reactive_mutiny::uni::channels::zero_copy::atomic::Atomic<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Debug + Send + Sync, OgreAllocatorType: BoundedOgreAllocator<ItemType> + 'a + Send + Sync,

Source§

impl<'a, ItemType, OgreAllocatorType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, OgreUnique<ItemType, OgreAllocatorType>> for reactive_mutiny::uni::channels::zero_copy::full_sync::FullSync<'a, ItemType, OgreAllocatorType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Debug + Send + Sync, OgreAllocatorType: BoundedOgreAllocator<ItemType> + 'a + Send + Sync,

Source§

impl<'a, ItemType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, Arc<ItemType>> for reactive_mutiny::multi::channels::arc::atomic::Atomic<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Send + Sync + Debug + Default + 'a,

Source§

impl<'a, ItemType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, Arc<ItemType>> for reactive_mutiny::multi::channels::arc::crossbeam::Crossbeam<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Send + Sync + Debug + 'a,

Source§

impl<'a, ItemType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, Arc<ItemType>> for reactive_mutiny::multi::channels::arc::full_sync::FullSync<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Send + Sync + Debug + Default + 'a,

Source§

impl<'a, ItemType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, ItemType> for reactive_mutiny::uni::channels::movable::atomic::Atomic<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: 'a + Send + Sync + Debug + Default,

Source§

impl<'a, ItemType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, ItemType> for reactive_mutiny::uni::channels::movable::crossbeam::Crossbeam<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: 'a + Send + Sync + Debug,

Source§

impl<'a, ItemType, const BUFFER_SIZE: usize, const MAX_STREAMS: usize> ChannelCommon<ItemType, ItemType> for reactive_mutiny::uni::channels::movable::full_sync::FullSync<'a, ItemType, BUFFER_SIZE, MAX_STREAMS>
where ItemType: Send + Sync + Debug + Default + 'a,

Source§

impl<'a, ItemType, const MAX_STREAMS: usize> ChannelCommon<ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
where ItemType: Send + Sync + Debug + 'a,