[−][src]Trait eventually::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 Event
Event to be stored in the EventStore
, typically an Aggregate::Event
.
type Error: AppendError
Possible errors returned by the EventStore
when requesting operations.
Required methods
fn append(
&mut self,
source_id: Self::SourceId,
version: Expected,
events: Vec<Self::Event>
) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send>>
&mut self,
source_id: Self::SourceId,
version: Expected,
events: Vec<Self::Event>
) -> Pin<Box<dyn Future<Output = Result<u32, Self::Error>> + Send>>
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 AppendError
.
The desired version for the new Event
s to append must be specified
through an Expected
element.
When using Expected::Any
, no checks on the current [Aggregate
]
values will be performed, disregarding optimistic locking.
When using Expected::Exact
, the Store will check that the current
version of the [Aggregate
] is exactly the one specified.
If the version is not the one expected from the Store, implementations
should raise an AppendError::Conflict
error.
Implementations could decide to return an error if the expected version is different from the one supplied in the method invocation.
fn stream(
&self,
source_id: Self::SourceId,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<Self::SourceId, Self::Event>, Self::Error>> + Send>>, Self::Error>> + Send>>
&self,
source_id: Self::SourceId,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<Self::SourceId, Self::Event>, Self::Error>> + Send>>, Self::Error>> + Send>>
Streams a list of Event
s from the EventStore
back to the application,
by specifying the desired SourceId
and Select
operation.
SourceId
will be used to request a particular EventStream
.
Select
specifies the selection strategy for the Event
s
in the returned EventStream
: take a look at type documentation
for all the available options.
fn stream_all(
&self,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<Self::SourceId, Self::Event>, Self::Error>> + Send>>, Self::Error>> + Send>>
&self,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<Self::SourceId, Self::Event>, Self::Error>> + Send>>, Self::Error>> + Send>>
Streams a list of Event
s from the EventStore
back to the application,
disregarding the SourceId
values but using a Select
operation.
SourceId
will be used to request a particular EventStream
.
Select
specifies the selection strategy for the Event
s
in the returned EventStream
: take a look at type documentation
for all the available options.
fn remove(
&mut self,
source_id: Self::SourceId
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>>
&mut self,
source_id: Self::SourceId
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>>
Implementors
impl<Id, Event> EventStore for EventStore<Id, Event> where
Event: Sync + Send + Debug + Clone,
Id: Hash + Eq + Sync + Send + Debug + Clone,
[src]
Event: Sync + Send + Debug + Clone,
Id: Hash + Eq + Sync + Send + Debug + Clone,
type SourceId = Id
type Event = Event
type Error = ConflictError
fn append(
&mut self,
id: <EventStore<Id, Event> as EventStore>::SourceId,
version: Expected,
events: Vec<<EventStore<Id, Event> as EventStore>::Event>
) -> Pin<Box<dyn Future<Output = Result<u32, <EventStore<Id, Event> as EventStore>::Error>> + Send>>
[src]
&mut self,
id: <EventStore<Id, Event> as EventStore>::SourceId,
version: Expected,
events: Vec<<EventStore<Id, Event> as EventStore>::Event>
) -> Pin<Box<dyn Future<Output = Result<u32, <EventStore<Id, Event> as EventStore>::Error>> + Send>>
fn stream(
&self,
id: <EventStore<Id, Event> as EventStore>::SourceId,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<<EventStore<Id, Event> as EventStore>::SourceId, <EventStore<Id, Event> as EventStore>::Event>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>
[src]
&self,
id: <EventStore<Id, Event> as EventStore>::SourceId,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<<EventStore<Id, Event> as EventStore>::SourceId, <EventStore<Id, Event> as EventStore>::Event>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>
fn stream_all(
&self,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<<EventStore<Id, Event> as EventStore>::SourceId, <EventStore<Id, Event> as EventStore>::Event>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>
[src]
&self,
select: Select
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Persisted<<EventStore<Id, Event> as EventStore>::SourceId, <EventStore<Id, Event> as EventStore>::Event>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>, <EventStore<Id, Event> as EventStore>::Error>> + Send>>
fn remove(
&mut self,
id: <EventStore<Id, Event> as EventStore>::SourceId
) -> Pin<Box<dyn Future<Output = Result<(), <EventStore<Id, Event> as EventStore>::Error>> + Send>>
[src]
&mut self,
id: <EventStore<Id, Event> as EventStore>::SourceId
) -> Pin<Box<dyn Future<Output = Result<(), <EventStore<Id, Event> as EventStore>::Error>> + Send>>