pub trait ReadLedger: Send + Sync {
// Required methods
fn record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
sha256: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn digest<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn forget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Where read records live (spec 3.1 §10 D7).
path is the file’s path relative to the workspace root with / separators, and
sha256 its lowercase hex content digest. InMemoryReadLedger is the default; a host
that resumes sessions in another process persists the records, as adk-harness does in
its store.
§Example
use adk_devtools::{InMemoryReadLedger, ReadLedger, ReadScope};
let ledger = InMemoryReadLedger::new();
let scope = ReadScope::new("app", "alice", "s1", "coder");
ledger.record(&scope, "src/lib.rs", "ab12").await?;
assert_eq!(ledger.digest(&scope, "src/lib.rs").await?.as_deref(), Some("ab12"));
ledger.forget(&scope, "src/lib.rs").await?;
assert_eq!(ledger.digest(&scope, "src/lib.rs").await?, None);Required Methods§
Sourcefn record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
sha256: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
sha256: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Records that scope read or wrote path and saw content with digest sha256,
replacing an earlier record.
§Errors
Returns the store’s error when the record cannot be written.
Sourcefn digest<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn digest<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The digest scope last recorded for path.
§Errors
Returns the store’s error when the record cannot be read.
Sourcefn forget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 ReadScope,
path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Forgets path for scope: the file was deleted or moved away.
§Errors
Returns the store’s error when the record cannot be removed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".