[−][src]Trait eventually_core::store::EventStore
An Event Store is an append-only, ordered list of Event
s
for a certain "source" -- e.g. an Aggregate
.
Associated Types
type SourceId: Eq
Type of the Source id, typically an AggregateId
.
type Offset: Ord
type Event
Event to be stored in the EventStore
, typically an Aggregate::Event
.
type Error
Possible errors returned by the EventStore
when requesting operations.
Required methods
fn append(
&mut self,
id: Self::SourceId,
events: Vec<Self::Event>
) -> BoxFuture<Result<(), Self::Error>>
&mut self,
id: Self::SourceId,
events: Vec<Self::Event>
) -> BoxFuture<Result<(), Self::Error>>
Appends a new list of Event
s to the Event Store, for the Source
entity specified by SourceId
.
append
is a transactional operation: it either appends all the events,
or none at all and returns an appropriate Error
.
fn stream(
&self,
id: Self::SourceId,
from: Self::Offset
) -> BoxFuture<Result<EventStream<Self>, Self::Error>>
&self,
id: Self::SourceId,
from: Self::Offset
) -> BoxFuture<Result<EventStream<Self>, Self::Error>>
Streams a list of Event
s from the EventStore
back to the application,
by specifying the desired SourceId
and Offset
.
SourceId
will be used to request a particular EventStream
.
Offset
will be used to specify a slice of the Event
s to retrieve
from the EventStore
. To request the whole list, use the Default
value for Offset
.