Skip to main content

CheckpointerHarness

Trait CheckpointerHarness 

Source
pub trait CheckpointerHarness: Send + Sync {
    // Required method
    fn open<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Arc<dyn Checkpointer>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Opens a Checkpointer backend for the conformance suite.

§Example

use std::sync::Arc;
use adk_graph::checkpoint::{Checkpointer, MemoryCheckpointer};
use adk_graph::conformance::CheckpointerHarness;

#[derive(Default)]
struct InMemory(Arc<MemoryCheckpointer>);

#[async_trait::async_trait]
impl CheckpointerHarness for InMemory {
    async fn open(&self) -> Arc<dyn Checkpointer> {
        self.0.clone()
    }
}

Required Methods§

Source

fn open<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Arc<dyn Checkpointer>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Opens the checkpointer.

For a durable backend every call returns a new handle over the same stored data, as a restarted or second process would see it. A process-local backend returns the same checkpointer every time. Panics when the backend cannot be opened.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§