pub struct Store<C, M> { /* private fields */ }Expand description
A PostgreSQL-backed EventStore.
Defaults are intentionally conservative:
- Positions are global and monotonic (
i64, backed byBIGSERIAL). - Metadata is stored as
jsonb(M: Serialize + DeserializeOwned).
Implementations§
Trait Implementations§
Source§impl<C, M> EventStore for Store<C, M>
impl<C, M> EventStore for Store<C, M>
fn codec(&self) -> &Self::Codec
Source§async fn stream_version<'a>(
&'a self,
aggregate_kind: &'a str,
aggregate_id: &'a Self::Id,
) -> Result<Option<Self::Position>, Self::Error>
async fn stream_version<'a>( &'a self, aggregate_kind: &'a str, aggregate_id: &'a Self::Id, ) -> Result<Option<Self::Position>, Self::Error>
Get the current version (latest position) for an aggregate stream. Read more
Source§fn begin<Conc: ConcurrencyStrategy>(
&mut self,
aggregate_kind: &str,
aggregate_id: Self::Id,
expected_version: Option<Self::Position>,
) -> Transaction<'_, Self, Conc>
fn begin<Conc: ConcurrencyStrategy>( &mut self, aggregate_kind: &str, aggregate_id: Self::Id, expected_version: Option<Self::Position>, ) -> Transaction<'_, Self, Conc>
Begin a transaction for appending events to an aggregate. Read more
Source§async fn append<'a>(
&'a mut self,
aggregate_kind: &'a str,
aggregate_id: &'a Self::Id,
expected_version: Option<Self::Position>,
events: Vec<PersistableEvent<Self::Metadata>>,
) -> Result<(), AppendError<Self::Position, Self::Error>>
async fn append<'a>( &'a mut self, aggregate_kind: &'a str, aggregate_id: &'a Self::Id, expected_version: Option<Self::Position>, events: Vec<PersistableEvent<Self::Metadata>>, ) -> Result<(), AppendError<Self::Position, Self::Error>>
Append events with optional version checking. Read more
Source§async fn load_events<'a>(
&'a self,
filters: &'a [EventFilter<Self::Id, Self::Position>],
) -> LoadEventsResult<Self::Id, Self::Position, Self::Metadata, Self::Error>
async fn load_events<'a>( &'a self, filters: &'a [EventFilter<Self::Id, Self::Position>], ) -> LoadEventsResult<Self::Id, Self::Position, Self::Metadata, Self::Error>
Load events matching the specified filters. Read more
Source§async fn append_expecting_new<'a>(
&'a mut self,
aggregate_kind: &'a str,
aggregate_id: &'a Self::Id,
events: Vec<PersistableEvent<Self::Metadata>>,
) -> Result<(), AppendError<Self::Position, Self::Error>>
async fn append_expecting_new<'a>( &'a mut self, aggregate_kind: &'a str, aggregate_id: &'a Self::Id, events: Vec<PersistableEvent<Self::Metadata>>, ) -> Result<(), AppendError<Self::Position, Self::Error>>
Append events expecting an empty stream. Read more
Auto Trait Implementations§
impl<C, M> Freeze for Store<C, M>where
C: Freeze,
impl<C, M> !RefUnwindSafe for Store<C, M>
impl<C, M> Send for Store<C, M>
impl<C, M> Sync for Store<C, M>
impl<C, M> Unpin for Store<C, M>
impl<C, M> !UnwindSafe for Store<C, M>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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