EventStore

Struct EventStore 

Source
pub struct EventStore<Id, Event>
where Id: Hash + Eq,
{ /* private fields */ }
Expand description

An in-memory EventStore implementation, backed by an HashMap.

Implementations§

Source§

impl<Id, Event> EventStore<Id, Event>
where Id: Hash + Eq,

Source

pub fn new(subscribe_capacity: usize) -> Self

Creates a new EventStore with a specified in-memory broadcast channel size, which will used by the subscribe_all method to notify of newly append events.

Trait Implementations§

Source§

impl<Id, Event: Clone> Clone for EventStore<Id, Event>
where Id: Hash + Eq + Clone,

Source§

fn clone(&self) -> EventStore<Id, Event>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Id, Event: Debug> Debug for EventStore<Id, Event>
where Id: Hash + Eq + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Id, Event> Default for EventStore<Id, Event>
where Id: Hash + Eq,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Id, Event> EventStore for EventStore<Id, Event>
where Id: Hash + Eq + Sync + Send + Debug + Clone, Event: Sync + Send + Debug + Clone,

Source§

type SourceId = Id

Type of the Source id, typically an AggregateId.
Source§

type Event = Event

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

type Error = ConflictError

Possible errors returned by the EventStore when requesting operations.
Source§

fn append( &mut self, id: Self::SourceId, version: Expected, events: Vec<Self::Event>, ) -> BoxFuture<'_, Result<u32, Self::Error>>

Appends a new list of Events to the Event Store, for the Source entity specified by SourceId. Read more
Source§

fn stream( &self, id: Self::SourceId, select: Select, ) -> BoxFuture<'_, Result<EventStream<'_, Self>, Self::Error>>

Streams a list of Events from the EventStore back to the application, by specifying the desired SourceId and Select operation. Read more
Source§

fn stream_all( &self, select: Select, ) -> BoxFuture<'_, Result<EventStream<'_, Self>, Self::Error>>

Streams a list of Events from the EventStore back to the application, disregarding the SourceId values but using a Select operation. Read more
Source§

fn remove( &mut self, id: Self::SourceId, ) -> BoxFuture<'_, Result<(), Self::Error>>

Drops all the Events related to one Source, specified by the provided SourceId.
Source§

impl<Id, Event> EventSubscriber for EventStore<Id, Event>
where Id: Hash + Eq + Sync + Send + Clone, Event: Sync + Send + Clone,

Source§

type SourceId = Id

Type of the Source id, typically an AggregateId.
Source§

type Event = Event

Event type stored in the EventStore, typically an Aggregate::Event.
Source§

type Error = SubscriberError

Possible errors returned when receiving events from the notification channel.
Source§

fn subscribe_all( &self, ) -> BoxFuture<'_, Result<EventStream<'_, Self>, Self::Error>>

Subscribes to all new events persisted in the EventStore, from the moment of calling this function, in the future. Read more

Auto Trait Implementations§

§

impl<Id, Event> Freeze for EventStore<Id, Event>

§

impl<Id, Event> !RefUnwindSafe for EventStore<Id, Event>

§

impl<Id, Event> Send for EventStore<Id, Event>
where Id: Send + Sync, Event: Send + Sync,

§

impl<Id, Event> Sync for EventStore<Id, Event>
where Id: Send + Sync, Event: Send + Sync,

§

impl<Id, Event> Unpin for EventStore<Id, Event>

§

impl<Id, Event> !UnwindSafe for EventStore<Id, Event>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.