pub trait EventStoreBackend<E: Event>: Send + Sync {
// Required methods
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
events: Vec<E>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_all_events<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_events_after<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn save_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
snapshot_data: Vec<u8>,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_latest_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, u64), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BackendStats> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Available on crate feature
cqrs only.Expand description
Backend trait for event storage implementations
Required Methods§
Sourcefn append<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
events: Vec<E>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
events: Vec<E>,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append events to an aggregate’s event stream
Sourcefn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get all events for a specific aggregate
Sourcefn get_all_events<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_events<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all events from all aggregates (for projection rebuild)
Sourcefn get_events_after<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_events_after<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<E>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get events after a specific version (for snapshot optimization)
Provided Methods§
Sourcefn save_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
snapshot_data: Vec<u8>,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
snapshot_data: Vec<u8>,
version: u64,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save a snapshot (optional, return Ok(()) if not supported)
Sourcefn get_latest_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, u64), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_latest_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, u64), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get latest snapshot (optional, return Err if not supported)