Skip to main content

DriverStore

Trait DriverStore 

Source
pub trait DriverStore: Send + Sync {
    // Required methods
    fn put<'life0, 'async_trait>(
        &'life0 self,
        record: DriverRecord,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<DriverRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DriverRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put_park<'life0, 'async_trait>(
        &'life0 self,
        park: DriverPark,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_park<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scope: &'life1 ApprovalScope,
        call_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<DriverPark>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_parks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        driver: Option<&'life1 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DriverPark>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_park<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scope: &'life1 ApprovalScope,
        call_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

The kernel’s store of mounted drivers and parked driver calls (spec 3.2 §7.7, §13 Q8).

Runs on every backend that holds the run, schedule and governance stores, with one conformance suite (driver_store_conformance_tests!, feature conformance):

BackendTypeFeature
In-memoryInMemoryDriverStoredrivers
SQLiteSqliteDriverStoredrivers, sqlite
PostgreSQLPostgresDriverStoredrivers, postgres
RedisRedisDriverStoredrivers, redis

§Example

use adk_kernel::drivers::{DriverManifest, DriverRecord, DriverStore};
use adk_kernel::stores::InMemoryDriverStore;

let store = InMemoryDriverStore::new();
let manifest = DriverManifest::from_toml("id = \"fs\"\ncommand = \"mcp-fs\"\n")?;
store.put(DriverRecord::new(manifest, "alice", chrono::Utc::now())).await?;
assert_eq!(store.get("fs").await?.unwrap().approved_by, "alice");

Required Methods§

Source

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

Inserts record, or replaces the record of the same driver.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DriverRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The record of driver id, or None.

§Errors

Returns KernelError::Store when the backend fails.

Source

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

Every record, ordered by driver id.

§Errors

Returns KernelError::Store when the backend fails.

Source

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

Deletes the record of driver id; false when there was none. Its parked calls stay until delete_park removes them.

§Errors

Returns KernelError::Store when the backend fails.

Source

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

Inserts park, or replaces the park of the same scope and call id.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn get_park<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 ApprovalScope, call_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<DriverPark>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The park of call call_id in scope, or None.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn list_parks<'life0, 'life1, 'async_trait>( &'life0 self, driver: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<DriverPark>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The parks of driver, or of every driver, ordered by scope and call id.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn delete_park<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scope: &'life1 ApprovalScope, call_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes the park of call call_id in scope; false when there was none.

§Errors

Returns KernelError::Store when the backend fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§