Skip to main content

ResumeTokenStore

Trait ResumeTokenStore 

Source
pub trait ResumeTokenStore: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ResumeToken>, ResumeTokenStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn save<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 ResumeToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), ResumeTokenStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn clear<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ResumeTokenStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for pluggable resume token persistence.

Implementations must be Send + Sync for use from async contexts.

§Cancellation Safety

Implementations should ensure that save is atomic (write-then-rename for files, or upsert for databases) so that a cancelled future does not leave a partially-written token.

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<ResumeToken>, ResumeTokenStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Loads the most recently persisted resume token, if any.

§Errors

Returns ResumeTokenStoreError on I/O or deserialization failure.

Source

fn save<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 ResumeToken, ) -> Pin<Box<dyn Future<Output = Result<(), ResumeTokenStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persists a resume token, overwriting any previous value.

§Errors

Returns ResumeTokenStoreError on I/O or serialization failure.

Source

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ResumeTokenStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Clears the persisted resume token.

§Errors

Returns ResumeTokenStoreError on I/O failure.

Implementors§