pub struct EventStore { /* private fields */ }Expand description
Append-only event store with per-stream indexing.
Internally uses a flat sequence (no nested streams), filtered at query time.
Implementations§
Source§impl EventStore
impl EventStore
Sourcepub fn new(config: EventStoreConfig) -> Self
pub fn new(config: EventStoreConfig) -> Self
Create a new event store with the given configuration.
Sourcepub fn append(
&self,
stream_id: impl Into<String>,
event_type: impl Into<String>,
payload: Value,
) -> u64
pub fn append( &self, stream_id: impl Into<String>, event_type: impl Into<String>, payload: Value, ) -> u64
Append an event to a stream. Returns the assigned sequence number.
Sourcepub fn query(&self, query: EventQuery) -> Vec<StoredEvent>
pub fn query(&self, query: EventQuery) -> Vec<StoredEvent>
Query events matching the filter.
Sourcepub fn replay(&self, stream_id: &str) -> Vec<StoredEvent>
pub fn replay(&self, stream_id: &str) -> Vec<StoredEvent>
Replay all events for a particular stream, in order.
Sourcepub fn subscribe(&self) -> Receiver<StoredEvent>
pub fn subscribe(&self) -> Receiver<StoredEvent>
Subscribe to new events.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for EventStore
impl !RefUnwindSafe for EventStore
impl !UnwindSafe for EventStore
impl Send for EventStore
impl Sync for EventStore
impl Unpin for EventStore
impl UnsafeUnpin for EventStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.