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