pub struct MmapLog<'a, ItemType: Send + Sync + Debug, const MAX_STREAMS: usize = 16> { /* private fields */ }Expand description
…
Trait Implementations§
source§impl<'a, ItemType: Send + Sync + Debug + 'a, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType: Send + Sync + Debug + 'a, const MAX_STREAMS: usize> ChannelCommon<'a, ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
source§fn new<IntoString: Into<String>>(name: IntoString) -> Arc<Self>
fn new<IntoString: Into<String>>(name: IntoString) -> Arc<Self>
Creates a new instance of this channel, to be referred to (in logs) as
namesource§fn flush<'life0, 'async_trait>(
&'life0 self,
timeout: Duration
) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>( &'life0 self, timeout: Duration ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Waits until all pending items are taken from this channel, up until
Returns the number of still unconsumed items – which is 0 if it was not interrupted by the timeout
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
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<'life0, 'async_trait>(
&'life0 self,
stream_id: u32,
timeout: Duration
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn gracefully_end_stream<'life0, 'async_trait>( &'life0 self, stream_id: u32, timeout: Duration ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Flushes & signals that the given
Returns
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<'life0, 'async_trait>(
&'life0 self,
timeout: Duration
) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn gracefully_end_all_streams<'life0, 'async_trait>( &'life0 self, timeout: Duration ) -> Pin<Box<dyn Future<Output = u32> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
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
Returns the number of un-ended streams – which is 0 if it was not interrupted by the timeout
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)
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.
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
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
fn pending_items_count(&self) -> u32
Tells how many events are waiting to be taken out of this channel.
IMPLEMENTORS: #[inline(always)]
IMPLEMENTORS: #[inline(always)]
source§fn buffer_size(&self) -> u32
fn buffer_size(&self) -> u32
Tells how many events may be produced ahead of the consumers.
IMPLEMENTORS: #[inline(always)]
IMPLEMENTORS: #[inline(always)]
source§impl<'a, ItemType: 'a + Send + Sync + Debug, const MAX_STREAMS: usize> ChannelConsumer<'a, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType: 'a + Send + Sync + Debug, const MAX_STREAMS: usize> ChannelConsumer<'a, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
source§fn consume(&self, stream_id: u32) -> Option<&'static ItemType>
fn consume(&self, stream_id: u32) -> Option<&'static ItemType>
Delivers the next event, whenever the Stream wants it.
IMPLEMENTORS: use #[inline(always)]
IMPLEMENTORS: use #[inline(always)]
source§fn keep_stream_running(&self, stream_id: u32) -> bool
fn keep_stream_running(&self, stream_id: u32) -> bool
Returns
IMPLEMENTORS: use #[inline(always)]
false if the Stream has been signaled to end its operations, causing it to report “out-of-elements” as soon as possible.IMPLEMENTORS: use #[inline(always)]
source§fn register_stream_waker(&self, stream_id: u32, waker: &Waker)
fn register_stream_waker(&self, stream_id: u32, waker: &Waker)
Shares, to implementors concern, how
IMPLEMENTORS: use #[inline(always)]
stream_id may be awaken.IMPLEMENTORS: use #[inline(always)]
source§fn drop_resources(&self, stream_id: u32)
fn drop_resources(&self, stream_id: u32)
Reports no more elements will be required through [provide()].
IMPLEMENTORS: use #[inline(always)]
IMPLEMENTORS: use #[inline(always)]
source§impl<'a, ItemType: Send + Sync + Debug + 'a, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType: Send + Sync + Debug + 'a, const MAX_STREAMS: usize> ChannelMulti<'a, ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
source§fn create_stream_for_old_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32)where
Self: ChannelConsumer<'a, &'static ItemType>,
fn create_stream_for_old_events( self: &Arc<Self> ) -> (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32)where Self: ChannelConsumer<'a, &'static ItemType>,
Implemented only for a few [Multi] channels, returns a
It is up to each implementor to define how back in the past those events may go, but it is known that
If called more than once, every stream will see all the past events available.
Currently
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_STREAMSsource§fn create_stream_for_new_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32)
fn create_stream_for_new_events( self: &Arc<Self> ) -> (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32)
Returns a
If called more than once, each
Currently
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_STREAMSsource§fn create_streams_for_old_and_new_events(
self: &Arc<Self>
) -> ((MutinyStream<'a, ItemType, Self, &'static ItemType>, u32), (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32))where
Self: ChannelConsumer<'a, &'static ItemType>,
fn create_streams_for_old_and_new_events( self: &Arc<Self> ) -> ((MutinyStream<'a, ItemType, Self, &'static ItemType>, u32), (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32))where Self: ChannelConsumer<'a, &'static ItemType>,
source§fn create_stream_for_old_and_new_events(
self: &Arc<Self>
) -> (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32)where
Self: ChannelConsumer<'a, &'static ItemType>,
fn create_stream_for_old_and_new_events( self: &Arc<Self> ) -> (MutinyStream<'a, ItemType, Self, &'static ItemType>, u32)where Self: ChannelConsumer<'a, &'static ItemType>,
Implemented only for a few [Multi] channels, returns a single
It is up to each implementor to define how back in the past those events may go, but it is known that
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
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_STREAMSsource§impl<'a, ItemType: 'a + Send + Sync + Debug, const MAX_STREAMS: usize> ChannelProducer<'a, ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType: 'a + Send + Sync + Debug, const MAX_STREAMS: usize> ChannelProducer<'a, ItemType, &'static ItemType> for MmapLog<'a, ItemType, MAX_STREAMS>
source§fn send(&self, item: ItemType) -> RetryConsumerResult<(), ItemType, ()>
fn send(&self, item: ItemType) -> RetryConsumerResult<(), ItemType, ()>
Similar to Self::send_with(), but for sending the already-built
See there for how to deal with the returned type. IMPLEMENTORS: #[inline(always)]
item.See there for how to deal with the returned type. IMPLEMENTORS: #[inline(always)]
source§fn send_with<F: FnOnce(&mut ItemType)>(
&self,
setter: F
) -> RetryConsumerResult<(), F, ()>
fn send_with<F: FnOnce(&mut ItemType)>( &self, setter: F ) -> RetryConsumerResult<(), F, ()>
Calls
The returned type is conversible to
setter, passing a slot so the payload may be filled there, then sends the event through this channel asynchronously.The returned type is conversible to
Result<(), F> by calling .into() on it, returning Err<setter> when the buffer is full,
to allow the caller to try again; otherwise you may add any retrying logic using the keen-retry crate’s API like in: Read moresource§fn send_derived(&self, _derived_item: &&'static ItemType) -> bool
fn send_derived(&self, _derived_item: &&'static ItemType) -> bool
For channels that stores the
The default implementation, though, is made for types that don’t have a derived item type.
IMPLEMENTORS: #[inline(always)]
DerivedItemType instead of the ItemType, this method may be useful
– for instance: if the Stream consumes Arc<String> (the derived item type) and the channel is for Strings, With this method one may send an Arc directly.The default implementation, though, is made for types that don’t have a derived item type.
IMPLEMENTORS: #[inline(always)]
source§impl<'a, ItemType: Send + Sync + Debug + 'a, const MAX_STREAMS: usize> Drop for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType: Send + Sync + Debug + 'a, const MAX_STREAMS: usize> Drop for MmapLog<'a, ItemType, MAX_STREAMS>
source§impl<ItemType: 'static + Debug + Send + Sync, const MAX_STREAMS: usize> FullDuplexMultiChannel for MmapLog<'static, ItemType, MAX_STREAMS>
impl<ItemType: 'static + Debug + Send + Sync, const MAX_STREAMS: usize> FullDuplexMultiChannel for MmapLog<'static, ItemType, MAX_STREAMS>
const MAX_STREAMS: usize = MAX_STREAMS
const BUFFER_SIZE: usize = 274_877_906_944usize
type ItemType = ItemType
type DerivedItemType = &'static ItemType
Auto Trait Implementations§
impl<'a, ItemType, const MAX_STREAMS: usize = 16> !RefUnwindSafe for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType, const MAX_STREAMS: usize> Send for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType, const MAX_STREAMS: usize> Sync for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType, const MAX_STREAMS: usize> Unpin for MmapLog<'a, ItemType, MAX_STREAMS>
impl<'a, ItemType, const MAX_STREAMS: usize = 16> !UnwindSafe for MmapLog<'a, ItemType, MAX_STREAMS>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more