use futures::future::BoxFuture;
use futures::stream::BoxStream;
pub type EventStream<'a, S> =
BoxStream<'a, Result<<S as EventStore>::Event, <S as EventStore>::Error>>;
pub trait EventStore {
type SourceId: Eq;
type Offset: Ord;
type Event;
type Error;
fn append(
&mut self,
id: Self::SourceId,
events: Vec<Self::Event>,
) -> BoxFuture<Result<(), Self::Error>>;
fn stream(
&self,
id: Self::SourceId,
from: Self::Offset,
) -> BoxFuture<Result<EventStream<Self>, Self::Error>>;
fn remove(&mut self, id: Self::SourceId) -> BoxFuture<Result<(), Self::Error>>;
}