pub struct PostgresStore { /* private fields */ }Expand description
A persistence store backed by PostgreSQL, implementing both EventStore and SnapshotStore over a shared connection pool; cheap to clone.
Implementations§
Source§impl PostgresStore
impl PostgresStore
Trait Implementations§
Source§impl Clone for PostgresStore
impl Clone for PostgresStore
Source§fn clone(&self) -> PostgresStore
fn clone(&self) -> PostgresStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PostgresStore
impl Debug for PostgresStore
Source§impl EventStore for PostgresStore
impl EventStore for PostgresStore
Source§async fn append(
&self,
id: &PersistenceId,
next_seq_no: SeqNo,
events: Vec<EncodedEvent>,
) -> Result<(), AppendError<Self::Error>>
async fn append( &self, id: &PersistenceId, next_seq_no: SeqNo, events: Vec<EncodedEvent>, ) -> Result<(), AppendError<Self::Error>>
Append the given events at sequence number
next_seq_no, the first one taking that number,
atomically: after a crash the stream contains all of them or none. The append is
conditional: if the stream’s actual next sequence number differs from next_seq_no,
another writer has extended the stream and the append must fail with
AppendError::Conflict, leaving the stream untouched; this fences concurrent
incarnations. next_seq_no is SeqNo::ZERO for an empty stream. An empty events
appends nothing but is still conditional.Source§async fn read(
&self,
id: &PersistenceId,
from_seq_no: SeqNo,
limit: NonZeroUsize,
) -> Result<Vec<StoredEvent>, Self::Error>
async fn read( &self, id: &PersistenceId, from_seq_no: SeqNo, limit: NonZeroUsize, ) -> Result<Vec<StoredEvent>, Self::Error>
Read up to
limit events from the given sequence number on, inclusive, in ascending
order. Replay pages through this until a page is short.Source§impl SnapshotStore for PostgresStore
impl SnapshotStore for PostgresStore
Source§async fn save(
&self,
id: &PersistenceId,
next_seq_no: SeqNo,
snapshot: EncodedSnapshot,
) -> Result<(), Self::Error>
async fn save( &self, id: &PersistenceId, next_seq_no: SeqNo, snapshot: EncodedSnapshot, ) -> Result<(), Self::Error>
Save the given snapshot together with
next_seq_no, the sequence number at which replay
resumes, replacing any earlier snapshot: only the latest one is ever loaded.Source§async fn load(
&self,
id: &PersistenceId,
) -> Result<Option<StoredSnapshot>, Self::Error>
async fn load( &self, id: &PersistenceId, ) -> Result<Option<StoredSnapshot>, Self::Error>
Load the latest snapshot, if any.
Auto Trait Implementations§
impl !RefUnwindSafe for PostgresStore
impl !UnwindSafe for PostgresStore
impl Freeze for PostgresStore
impl Send for PostgresStore
impl Sync for PostgresStore
impl Unpin for PostgresStore
impl UnsafeUnpin for PostgresStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<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