pub trait Projection {
type SourceId: Eq;
type Event;
type Error;
// Required method
fn project<'a>(
&'a mut self,
event: Persisted<Self::SourceId, Self::Event>,
) -> BoxFuture<'a, Result<(), Self::Error>>;
}
Expand description
A Projection
is an optimized read model (or materialized view)
of an Aggregate
model(s), that can be assembled by left-folding
its previous state and a number of ordered, consecutive events.
The events passed to a Projection
have been persisted onto
an EventStore
first.
Required Associated Types§
Sourcetype SourceId: Eq
type SourceId: Eq
Type of the Source id, typically an AggregateId
.
Sourcetype Event
type Event
Event to be stored in the EventStore
, typically an Aggregate::Event
.