pub struct SqliteSnapshotStore { /* private fields */ }Implementations§
Source§impl SqliteSnapshotStore
impl SqliteSnapshotStore
pub fn new(pool: SqlitePool, table_name: Option<String>) -> Self
pub async fn initialize(&self) -> Result<()>
Trait Implementations§
Source§impl SnapshotStore for SqliteSnapshotStore
impl SnapshotStore for SqliteSnapshotStore
Source§fn save_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot: AggregateSnapshot,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot: AggregateSnapshot,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store a new snapshot
Source§fn load_latest_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 AggregateId,
) -> Pin<Box<dyn Future<Output = Result<Option<AggregateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_latest_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 AggregateId,
) -> Pin<Box<dyn Future<Output = Result<Option<AggregateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load the latest snapshot for an aggregate
Source§fn load_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<AggregateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<AggregateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load a specific snapshot by ID
Source§fn list_snapshots<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 AggregateId,
) -> Pin<Box<dyn Future<Output = Result<Vec<AggregateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_snapshots<'life0, 'life1, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 AggregateId,
) -> Pin<Box<dyn Future<Output = Result<Vec<AggregateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get all snapshots for an aggregate, ordered by version descending
Source§fn delete_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_snapshot<'life0, 'async_trait>(
&'life0 self,
snapshot_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete a snapshot
Source§fn cleanup_old_snapshots<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 SnapshotConfig,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cleanup_old_snapshots<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 SnapshotConfig,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Clean up old snapshots based on configuration
Source§fn should_take_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 AggregateId,
current_version: AggregateVersion,
config: &'life2 SnapshotConfig,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn should_take_snapshot<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
aggregate_id: &'life1 AggregateId,
current_version: AggregateVersion,
config: &'life2 SnapshotConfig,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if a snapshot should be taken for an aggregate at the given version
Auto Trait Implementations§
impl Freeze for SqliteSnapshotStore
impl !RefUnwindSafe for SqliteSnapshotStore
impl Send for SqliteSnapshotStore
impl Sync for SqliteSnapshotStore
impl Unpin for SqliteSnapshotStore
impl !UnwindSafe for SqliteSnapshotStore
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more