[][src]Trait cqrs::EntitySource

pub trait EntitySource<A, E>: EventSource<A, E> + SnapshotSource<A> where
    A: Aggregate,
    E: AggregateEvent<A>, 
{ fn load_from_snapshot<I>(
        &self,
        id: &I
    ) -> Result<Option<HydratedAggregate<A>>, Self::Error>
    where
        I: AggregateId<A>
, { ... }
fn refresh<I>(
        &self,
        id: &I,
        aggregate: &mut HydratedAggregate<A>
    ) -> Result<(), Self::Error>
    where
        I: AggregateId<A>
, { ... }
fn rehydrate<I>(
        &self,
        id: &I
    ) -> Result<Option<HydratedAggregate<A>>, EntityLoadError<Self::Error, Self::Error>>
    where
        I: AggregateId<A>
, { ... } }

A source for loading an Entity.

Provided methods

fn load_from_snapshot<I>(
    &self,
    id: &I
) -> Result<Option<HydratedAggregate<A>>, Self::Error> where
    I: AggregateId<A>, 

Loads an identified Entity from the latest known snapshot.

If the SnapshotSource returns an error, it is passed along. If the source does not have a snapshot for the requested entity, returns Ok(None).

fn refresh<I>(
    &self,
    id: &I,
    aggregate: &mut HydratedAggregate<A>
) -> Result<(), Self::Error> where
    I: AggregateId<A>, 

Refreshes an existing hydrated aggregate with the given id.

Errors may occur while loading the events.

fn rehydrate<I>(
    &self,
    id: &I
) -> Result<Option<HydratedAggregate<A>>, EntityLoadError<Self::Error, Self::Error>> where
    I: AggregateId<A>, 

Loads an entity from the most recent snapshot of its aggregate, then applies any newer events that have not yet been applied.

Errors may occur while loading the snapshot or the events. If no snapshot or events can be found for the entity, returns Ok(None)

Loading content...

Implementors

impl<A, E, T> EntitySource<A, E> for T where
    A: Aggregate,
    E: AggregateEvent<A>,
    T: EventSource<A, E> + SnapshotSource<A>, 
[src]

Loading content...