pub struct TestLog<M: RemoteMessage> { /* private fields */ }
Expand description
An in-memory log for testing.
Implementations§
Source§impl<M: RemoteMessage> TestLog<M>
impl<M: RemoteMessage> TestLog<M>
Trait Implementations§
Source§impl<M: RemoteMessage + Clone> MessageLog<M> for TestLog<M>
impl<M: RemoteMessage + Clone> MessageLog<M> for TestLog<M>
Source§type Stream<'a> = Iter<IntoIter<Result<(u64, M), MessageLogError>>>
type Stream<'a> = Iter<IntoIter<Result<(u64, M), MessageLogError>>>
The type of the stream returned from read operations on this log.
Source§fn append<'life0, 'async_trait>(
&'life0 mut self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<(), MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 mut self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<(), MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append a message to a buffer. The appended messages will only be persisted and available to
read after calling [
flush
].Source§fn flush<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<SeqId, MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<SeqId, MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush the appended messages. Return the next sequence id of the last persistent message.
Source§fn append_and_flush<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 M,
) -> Pin<Box<dyn Future<Output = Result<SeqId, MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_and_flush<'life0, 'life1, 'async_trait>(
&'life0 mut self,
message: &'life1 M,
) -> Pin<Box<dyn Future<Output = Result<SeqId, MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Directly flush the message. All previously buffered messages will be flushed as well.
This convenience method can prevent an additional copy of the message by directly writing to the log.
Source§fn trim<'life0, 'async_trait>(
&'life0 mut self,
new_start: SeqId,
) -> Pin<Box<dyn Future<Output = Result<(), MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn trim<'life0, 'async_trait>(
&'life0 mut self,
new_start: SeqId,
) -> Pin<Box<dyn Future<Output = Result<(), MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Trim the persistent logs before the given [
new_start
] non-inclusively.Source§fn read<'life0, 'async_trait>(
&'life0 self,
seq_id: SeqId,
) -> Pin<Box<dyn Future<Output = Result<Self::Stream<'_>, MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read<'life0, 'async_trait>(
&'life0 self,
seq_id: SeqId,
) -> Pin<Box<dyn Future<Output = Result<Self::Stream<'_>, MessageLogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Given a sequence id, return a stream of message and sequence id tuples that are persisted
after the given sequence id inclusively. The stream will yield errors when streaming
messages back if any. It will also yield errors if creating the stream itself fails.
Auto Trait Implementations§
impl<M> Freeze for TestLog<M>
impl<M> RefUnwindSafe for TestLog<M>
impl<M> Send for TestLog<M>
impl<M> Sync for TestLog<M>
impl<M> Unpin for TestLog<M>
impl<M> UnwindSafe for TestLog<M>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more