Skip to main content

ControlStoreHarness

Trait ControlStoreHarness 

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

    // Provided method
    fn is_durable(&self) -> bool { ... }
}
Expand description

Opens a ControlStore backend for the conformance suite.

§Example

use std::sync::Arc;
use adk_kernel::conformance::ControlStoreHarness;
use adk_kernel::control::{ControlStore, InMemoryControlStore};

struct InMemory;

#[async_trait::async_trait]
impl ControlStoreHarness for InMemory {
    async fn open(&self) -> Arc<dyn ControlStore> {
        Arc::new(InMemoryControlStore::new())
    }

    fn is_durable(&self) -> bool {
        false
    }
}

Required Methods§

Source

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

Opens a store. For a durable backend every call returns a new handle over the same stored data. Panics when the backend cannot be opened.

Provided Methods§

Source

fn is_durable(&self) -> bool

Whether data written through one handle is visible through the next.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§