pub struct TestEventLog<I> { /* private fields */ }Available on crate feature
test only.Expand description
An in-memory implementation of EventLog for testing purposes.
Trait Implementations§
Source§impl<I: Clone> Clone for TestEventLog<I>
impl<I: Clone> Clone for TestEventLog<I>
Source§fn clone(&self) -> TestEventLog<I>
fn clone(&self) -> TestEventLog<I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<I: Debug> Debug for TestEventLog<I>
impl<I: Debug> Debug for TestEventLog<I>
Source§impl<I> Default for TestEventLog<I>
impl<I> Default for TestEventLog<I>
Source§impl<I> EventLog for TestEventLog<I>
impl<I> EventLog for TestEventLog<I>
type Id = I
type Error = Error
Source§async fn persist<E, ToBytes, ToBytesError>(
&mut self,
type_name: &'static str,
id: &Self::Id,
_last_seq_no: Option<NonZeroU64>,
event: &E,
to_bytes: &ToBytes,
) -> Result<NonZeroU64, Self::Error>
async fn persist<E, ToBytes, ToBytesError>( &mut self, type_name: &'static str, id: &Self::Id, _last_seq_no: Option<NonZeroU64>, event: &E, to_bytes: &ToBytes, ) -> Result<NonZeroU64, Self::Error>
Persist the given event and optional tag for the given entity ID and return the
sequence number for the persisted event. The given last sequence number is used for
optimistic locking, i.e. it must match the current last sequence number of the event log.
Source§async fn last_seq_no(
&self,
type_name: &'static str,
id: &Self::Id,
) -> Result<Option<NonZeroU64>, Self::Error>
async fn last_seq_no( &self, type_name: &'static str, id: &Self::Id, ) -> Result<Option<NonZeroU64>, Self::Error>
Get the last sequence number for the given type name and entity ID.
Source§async fn events_by_id<E, FromBytes, FromBytesError>(
&self,
type_name: &'static str,
id: &Self::Id,
seq_no: NonZeroU64,
from_bytes: FromBytes,
) -> Result<impl Stream<Item = Result<(NonZeroU64, E), Self::Error>> + Send, Self::Error>
async fn events_by_id<E, FromBytes, FromBytesError>( &self, type_name: &'static str, id: &Self::Id, seq_no: NonZeroU64, from_bytes: FromBytes, ) -> Result<impl Stream<Item = Result<(NonZeroU64, E), Self::Error>> + Send, Self::Error>
Get the events for the given type name and entity ID starting at the given sequence
number.
Source§async fn events_by_type<E, FromBytes, FromBytesError>(
&self,
type_name: &'static str,
seq_no: NonZeroU64,
from_bytes: FromBytes,
) -> Result<impl Stream<Item = Result<(NonZeroU64, E), Self::Error>> + Send, Self::Error>
async fn events_by_type<E, FromBytes, FromBytesError>( &self, type_name: &'static str, seq_no: NonZeroU64, from_bytes: FromBytes, ) -> Result<impl Stream<Item = Result<(NonZeroU64, E), Self::Error>> + Send, Self::Error>
Get the events for the given entity type starting at the given sequence number.
Source§const MAX_SEQ_NO: NonZeroU64 = NonZeroU64::MAX
const MAX_SEQ_NO: NonZeroU64 = NonZeroU64::MAX
The maximum value for sequence numbers. Defaults to
NonZeroU64::MAX unless overriden by an
implementation.Auto Trait Implementations§
impl<I> Freeze for TestEventLog<I>
impl<I> !RefUnwindSafe for TestEventLog<I>
impl<I> Send for TestEventLog<I>
impl<I> Sync for TestEventLog<I>
impl<I> Unpin for TestEventLog<I>
impl<I> !UnwindSafe for TestEventLog<I>
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