Skip to main content

IdempotencyStore

Trait IdempotencyStore 

Source
pub trait IdempotencyStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn begin<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        fingerprint: u64,
        lock_ttl: Duration,
    ) -> Pin<Box<dyn Future<Output = Begin> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        response: StoredResponse,
        ttl: Duration,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn abandon<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Where idempotency keys live

Required Methods§

Source

fn begin<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, fingerprint: u64, lock_ttl: Duration, ) -> Pin<Box<dyn Future<Output = Begin> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Claim key for a request with this fingerprint. A claim that is never completed must lapse after lock_ttl.

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, response: StoredResponse, ttl: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Keep response for ttl

Source

fn abandon<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Forget a claim so the request can be retried

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§