Skip to main content

CheckpointStore

Trait CheckpointStore 

Source
pub trait CheckpointStore: Send + Sync {
    // Required methods
    fn save_with_trace<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        trace_id: &'life1 TraceId,
        checkpoint: &'life2 Checkpoint,
    ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn load<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 CheckpointId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, CheckpointStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_latest<'life0, 'life1, 'async_trait>(
        &'life0 self,
        trace_id: &'life1 TraceId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, CheckpointStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        trace_id: &'life1 TraceId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckpointId>, CheckpointStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 CheckpointId,
    ) -> Pin<Box<dyn Future<Output = Result<bool, CheckpointStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn prune<'life0, 'life1, 'async_trait>(
        &'life0 self,
        trace_id: &'life1 TraceId,
        keep: usize,
    ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Checkpoint 存储后端 SPI。

与类型解耦 — 存储层序列化/反序列化 S

Required Methods§

Source

fn save_with_trace<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, trace_id: &'life1 TraceId, checkpoint: &'life2 Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

保存 Checkpoint 并关联 trace_id。

Source

fn load<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 CheckpointId, ) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn load_latest<'life0, 'life1, 'async_trait>( &'life0 self, trace_id: &'life1 TraceId, ) -> Pin<Box<dyn Future<Output = Result<Option<Checkpoint>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, trace_id: &'life1 TraceId, ) -> Pin<Box<dyn Future<Output = Result<Vec<CheckpointId>, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 CheckpointId, ) -> Pin<Box<dyn Future<Output = Result<bool, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn prune<'life0, 'life1, 'async_trait>( &'life0 self, trace_id: &'life1 TraceId, keep: usize, ) -> Pin<Box<dyn Future<Output = Result<usize, CheckpointStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§