pub struct PostgresEventLog<I> { /* private fields */ }
Expand description
An EventLog implementation based on PostgreSQL.
Implementations§
Trait Implementations§
Source§impl<I: Clone> Clone for PostgresEventLog<I>
impl<I: Clone> Clone for PostgresEventLog<I>
Source§fn clone(&self) -> PostgresEventLog<I>
fn clone(&self) -> PostgresEventLog<I>
Returns a copy 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 for PostgresEventLog<I>
impl<I> Debug for PostgresEventLog<I>
Source§impl<I> EventLog for PostgresEventLog<I>
impl<I> EventLog for PostgresEventLog<I>
Source§const MAX_SEQ_NO: NonZeroU64
const MAX_SEQ_NO: NonZeroU64
The maximum value for sequence numbers. As PostgreSQL does not support unsigned integers,
this is i64::MAX
or 9_223_372_036_854_775_807
.
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.
Auto Trait Implementations§
impl<I> Freeze for PostgresEventLog<I>
impl<I> !RefUnwindSafe for PostgresEventLog<I>
impl<I> Send for PostgresEventLog<I>where
I: Send,
impl<I> Sync for PostgresEventLog<I>where
I: Sync,
impl<I> Unpin for PostgresEventLog<I>where
I: Unpin,
impl<I> !UnwindSafe for PostgresEventLog<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