pub trait EventStore: Send + Sync {
// Required methods
fn head_seq<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn append<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
expected_seq: u64,
events: Vec<EventEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read_range<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
from_seq: u64,
to_seq: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Append-only event store with optimistic concurrency.
Required Methods§
Sourcefn head_seq<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn head_seq<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the current head sequence for run_id.
Sourcefn append<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
expected_seq: u64,
events: Vec<EventEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
expected_seq: u64,
events: Vec<EventEnvelope>,
) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Appends events atomically if expected_seq matches the current head.
Sourcefn read_range<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
from_seq: u64,
to_seq: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_range<'life0, 'async_trait>(
&'life0 self,
run_id: RunId,
from_seq: u64,
to_seq: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<EventEnvelope>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads a contiguous event range starting at from_seq.