Skip to main content

LedgerSink

Trait LedgerSink 

Source
pub trait LedgerSink: Send + Sync {
    // Required method
    fn record<'life0, 'async_trait>(
        &'life0 self,
        activity: Activity,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Where activity goes (spec 3.2 §7.10): the Ledger, or a LateLedgerSink a runtime the kernel hosts writes through before the kernel exists. The harness writes its tool events and audit records through one.

§Example

use std::sync::Arc;
use adk_kernel::proc::{Activity, InMemoryLedgerStore, Ledger, LedgerKey, LedgerKind, LedgerSink};

let ledger = Ledger::new(Arc::new(InMemoryLedgerStore::new()), LedgerKey::from_bytes([1; 32]));
let sink: Arc<dyn LedgerSink> = Arc::new(ledger.clone());
sink.record(Activity::new(LedgerKind::Intent, "harness")).await?;

Required Methods§

Source

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

Records activity.

§Errors

Returns an error with code LEDGER_INVALID_CODE when the activity carries something other than labels, counts and durations, or the store’s error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§