[][src]Trait eventually::Projection

pub trait Projection {
    type SourceId: Eq;
    type Event;
    type Error;
    fn project(
        &'a mut self,
        event: Persisted<Self::SourceId, Self::Event>
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + 'a + Send>>; }

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.

Associated Types

type SourceId: Eq

Type of the Source id, typically an AggregateId.

type Event

Event to be stored in the EventStore, typically an Aggregate::Event.

type Error

Type of the possible error that might occur when projecting the next state.

Loading content...

Required methods

fn project(
    &'a mut self,
    event: Persisted<Self::SourceId, Self::Event>
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + 'a + Send>>

Updates the next value of the Projection using the provided event value.

Loading content...

Implementors

Loading content...