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§
Sourcefn 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 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.
Sourcefn 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 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.