Struct postgres_es::PostgresSnapshotStore [−][src]
pub struct PostgresSnapshotStore<A: Aggregate> { /* fields omitted */ }
Expand description
Storage engine using a Postgres database backing.
This is an snapshot-sourced EventStore
, meaning it uses the serialized aggregate as the
primary source of truth for the state of the aggregate.
The individual events are also persisted but are used only for updating queries.
For a event-sourced EventStore
see PostgresStore
.
Implementations
Trait Implementations
type AC = PostgresSnapshotStoreAggregateContext<A>
type AC = PostgresSnapshotStoreAggregateContext<A>
Provides the current state of an aggregate along with surrounding context. This is used by the CqrsFramework when loading an aggregate in order to handle incoming commands. Read more
Load all events for a particular aggregate_id
fn load_aggregate<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str
) -> Pin<Box<dyn Future<Output = PostgresSnapshotStoreAggregateContext<A>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn load_aggregate<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str
) -> Pin<Box<dyn Future<Output = PostgresSnapshotStoreAggregateContext<A>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Load aggregate at current state
fn commit<'life0, 'async_trait>(
&'life0 self,
events: Vec<A::Event>,
context: PostgresSnapshotStoreAggregateContext<A>,
metadata: HashMap<String, String>
) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope<A>>, AggregateError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 self,
events: Vec<A::Event>,
context: PostgresSnapshotStoreAggregateContext<A>,
metadata: HashMap<String, String>
) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope<A>>, AggregateError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Commit new events
fn wrap_events(
&self,
aggregate_id: &str,
current_sequence: usize,
resultant_events: Vec<<A as Aggregate>::Event, Global>,
base_metadata: HashMap<String, String, RandomState>
) -> Vec<EventEnvelope<A>, Global>
fn wrap_events(
&self,
aggregate_id: &str,
current_sequence: usize,
resultant_events: Vec<<A as Aggregate>::Event, Global>,
base_metadata: HashMap<String, String, RandomState>
) -> Vec<EventEnvelope<A>, Global>
Method to wrap a set of events with the additional metadata needed for persistence and publishing