pub struct EventStore<A: Aggregate<E>, E> { /* private fields */ }Expand description
The event store used to persisting events. Besides from using the store, to well, store events, it can also be used to fetch them, and to stream updates synced between different instances
Implementations§
Source§impl<A: Aggregate<E> + Send + Sync + Clone, E: Send> EventStore<A, E>
impl<A: Aggregate<E> + Send + Sync + Clone, E: Send> EventStore<A, E>
pub fn builder() -> EventStoreBuilder<A, E, (), ()>
Sourcepub async fn aggregate(
&self,
aggregate_id: Uuid,
) -> Result<Option<A>, AdapterError>
pub async fn aggregate( &self, aggregate_id: Uuid, ) -> Result<Option<A>, AdapterError>
Fetches a single aggregate
Sourcepub async fn aggregate_without_snapshot(
&self,
aggregate_id: Uuid,
) -> Result<Option<A>, AdapterError>
pub async fn aggregate_without_snapshot( &self, aggregate_id: Uuid, ) -> Result<Option<A>, AdapterError>
Fetches a single aggregate
Sourcepub async fn ids(&self) -> Result<BoxStream<'_, Uuid>, AdapterError>
pub async fn ids(&self) -> Result<BoxStream<'_, Uuid>, AdapterError>
Returns all ids in the store
Sourcepub async fn all(
&self,
) -> Result<BoxStream<'_, Result<A, AdapterError>>, AdapterError>
pub async fn all( &self, ) -> Result<BoxStream<'_, Result<A, AdapterError>>, AdapterError>
Returns all aggregates in the store
Sourcepub async fn create<T: IntoEventList<E>>(
&self,
events: T,
) -> Result<A, CreateError>
pub async fn create<T: IntoEventList<E>>( &self, events: T, ) -> Result<A, CreateError>
Creates a new aggregate
Sourcepub async fn create_with_external_ids(
&self,
events: Vec<Event<E>>,
external_ids: Vec<String>,
) -> Result<A, CreateError>
pub async fn create_with_external_ids( &self, events: Vec<Event<E>>, external_ids: Vec<String>, ) -> Result<A, CreateError>
Creates a new aggregate
Sourcepub async fn store<T: IntoEventList<E>, F: Fn(&A) -> T + Send + Sync>(
&self,
aggregate_id: Uuid,
callback: F,
) -> Result<A, StoreError>
pub async fn store<T: IntoEventList<E>, F: Fn(&A) -> T + Send + Sync>( &self, aggregate_id: Uuid, callback: F, ) -> Result<A, StoreError>
Stores events to an existing aggregate
Sourcepub async fn try_store<T: IntoEventList<E>, F: Fn(&A) -> Result<T, I> + Send + Sync, I: Send + Sync>(
&self,
aggregate_id: Uuid,
callback: F,
) -> Result<Result<A, I>, StoreError>
pub async fn try_store<T: IntoEventList<E>, F: Fn(&A) -> Result<T, I> + Send + Sync, I: Send + Sync>( &self, aggregate_id: Uuid, callback: F, ) -> Result<Result<A, I>, StoreError>
Stores events to an existing aggregate with the option to throw a validation error
pub async fn stream_realtime( &self, ) -> Result<BoxStream<'_, Result<RealtimeStreamData<A, E>, AdapterError>>, AdapterError>
Trait Implementations§
Auto Trait Implementations§
impl<A, E> Freeze for EventStore<A, E>
impl<A, E> !RefUnwindSafe for EventStore<A, E>
impl<A, E> Send for EventStore<A, E>where
A: Send,
impl<A, E> Sync for EventStore<A, E>where
A: Sync,
impl<A, E> Unpin for EventStore<A, E>where
A: Unpin,
impl<A, E> !UnwindSafe for EventStore<A, E>
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