Struct eventsourced_postgres::PostgresEvtLog
source · pub struct PostgresEvtLog<I> { /* private fields */ }
Expand description
An EvtLog implementation based on PostgreSQL.
Implementations§
Trait Implementations§
source§impl<I: Clone> Clone for PostgresEvtLog<I>
impl<I: Clone> Clone for PostgresEvtLog<I>
source§fn clone(&self) -> PostgresEvtLog<I>
fn clone(&self) -> PostgresEvtLog<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 PostgresEvtLog<I>
impl<I> Debug for PostgresEvtLog<I>
source§impl<I> EvtLog for PostgresEvtLog<I>
impl<I> EvtLog for PostgresEvtLog<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>,
evt: &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>, evt: &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 evts_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 evts_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 evts_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 evts_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 PostgresEvtLog<I>
impl<I> !RefUnwindSafe for PostgresEvtLog<I>
impl<I> Send for PostgresEvtLog<I>where
I: Send,
impl<I> Sync for PostgresEvtLog<I>where
I: Sync,
impl<I> Unpin for PostgresEvtLog<I>where
I: Unpin,
impl<I> !UnwindSafe for PostgresEvtLog<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
source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<TraitVariantBlanketType> LocalEvtLog for TraitVariantBlanketType
impl<TraitVariantBlanketType> LocalEvtLog for TraitVariantBlanketType
type Id = <TraitVariantBlanketType as EvtLog>::Id
type Error = <TraitVariantBlanketType as EvtLog>::Error
source§const MAX_SEQ_NO: NonZero<u64> = _
const MAX_SEQ_NO: NonZero<u64> = _
The maximum value for sequence numbers. Defaults to
NonZeroU64::MAX
unless overriden by an
implementation.source§async fn persist<E, ToBytes, ToBytesError>(
&mut self,
type_name: &'static str,
id: &<TraitVariantBlanketType as LocalEvtLog>::Id,
last_seq_no: Option<NonZero<u64>>,
evt: &E,
to_bytes: &ToBytes
) -> Result<NonZero<u64>, <TraitVariantBlanketType as LocalEvtLog>::Error>
async fn persist<E, ToBytes, ToBytesError>( &mut self, type_name: &'static str, id: &<TraitVariantBlanketType as LocalEvtLog>::Id, last_seq_no: Option<NonZero<u64>>, evt: &E, to_bytes: &ToBytes ) -> Result<NonZero<u64>, <TraitVariantBlanketType as LocalEvtLog>::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: &<TraitVariantBlanketType as LocalEvtLog>::Id
) -> Result<Option<NonZero<u64>>, <TraitVariantBlanketType as LocalEvtLog>::Error>
async fn last_seq_no( &self, type_name: &'static str, id: &<TraitVariantBlanketType as LocalEvtLog>::Id ) -> Result<Option<NonZero<u64>>, <TraitVariantBlanketType as LocalEvtLog>::Error>
Get the last sequence number for the given type name and entity ID.
source§async fn evts_by_id<E, FromBytes, FromBytesError>(
&self,
type_name: &'static str,
id: &<TraitVariantBlanketType as LocalEvtLog>::Id,
seq_no: NonZero<u64>,
from_bytes: FromBytes
) -> Result<impl Stream<Item = Result<(NonZero<u64>, E), <TraitVariantBlanketType as LocalEvtLog>::Error>> + Send, <TraitVariantBlanketType as LocalEvtLog>::Error>
async fn evts_by_id<E, FromBytes, FromBytesError>( &self, type_name: &'static str, id: &<TraitVariantBlanketType as LocalEvtLog>::Id, seq_no: NonZero<u64>, from_bytes: FromBytes ) -> Result<impl Stream<Item = Result<(NonZero<u64>, E), <TraitVariantBlanketType as LocalEvtLog>::Error>> + Send, <TraitVariantBlanketType as LocalEvtLog>::Error>
Get the events for the given type name and entity ID starting at the given sequence
number.
source§async fn evts_by_type<E, FromBytes, FromBytesError>(
&self,
type_name: &'static str,
seq_no: NonZero<u64>,
from_bytes: FromBytes
) -> Result<impl Stream<Item = Result<(NonZero<u64>, E), <TraitVariantBlanketType as LocalEvtLog>::Error>> + Send, <TraitVariantBlanketType as LocalEvtLog>::Error>
async fn evts_by_type<E, FromBytes, FromBytesError>( &self, type_name: &'static str, seq_no: NonZero<u64>, from_bytes: FromBytes ) -> Result<impl Stream<Item = Result<(NonZero<u64>, E), <TraitVariantBlanketType as LocalEvtLog>::Error>> + Send, <TraitVariantBlanketType as LocalEvtLog>::Error>
Get the events for the given entity type starting at the given sequence number.