pub trait IdempotencyStore: Send + Sync {
// Required methods
fn upsert_result<'life0, 'async_trait>(
&'life0 self,
result: IdempotentResult,
) -> Pin<Box<dyn Future<Output = Result<bool, IdempotencyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_result<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 IdempotencyKey,
) -> Pin<Box<dyn Future<Output = Result<Option<IdempotentResult>, IdempotencyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn cleanup_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, IdempotencyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IdempotencyStats, IdempotencyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for idempotency stores (in-memory, Redis, database, etc.)
Required Methods§
Sourcefn upsert_result<'life0, 'async_trait>(
&'life0 self,
result: IdempotentResult,
) -> Pin<Box<dyn Future<Output = Result<bool, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upsert_result<'life0, 'async_trait>(
&'life0 self,
result: IdempotentResult,
) -> Pin<Box<dyn Future<Output = Result<bool, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Upsert a result by idempotency key Returns true if this is a new key, false if it already existed
Sourcefn get_result<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 IdempotencyKey,
) -> Pin<Box<dyn Future<Output = Result<Option<IdempotentResult>, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_result<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 IdempotencyKey,
) -> Pin<Box<dyn Future<Output = Result<Option<IdempotentResult>, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a result by idempotency key
Sourcefn cleanup_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cleanup_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete expired results (cleanup)
Sourcefn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IdempotencyStats, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<IdempotencyStats, IdempotencyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get statistics about the store