Skip to main content

DerivedCache

Struct DerivedCache 

Source
pub struct DerivedCache { /* private fields */ }
Expand description

A disposable, closure-keyed derived observation cache rooted under a field store’s cache/ directory.

Implementations§

Source§

impl DerivedCache

Source

pub fn open(root: impl AsRef<Path>) -> Result<Self>

Open (creating if needed) a derived cache rooted at root.

Source

pub fn root(&self) -> &Path

The cache root directory.

Source

pub fn get(&self, id: &NodeId) -> Result<Option<Vec<u8>>>

Fetch a cached output, verifying the sidecar digest.

  • absent bytes or absent sidecar -> Ok(None) (a miss; disposable).
  • sidecar present but BLAKE3(bytes) != sidecar -> crate::ErrorClass::IntegrityMismatch (fail closed; never return wrong bytes).
Source

pub fn put(&mut self, id: &NodeId, bytes: &[u8]) -> Result<u64>

Store an output atomically with its sidecar digest. Returns the number of output bytes written.

Source

pub fn contains(&self, id: &NodeId) -> Result<bool>

Whether an output file exists for id (the sidecar is not checked).

Source

pub fn total_bytes(&self) -> Result<u64>

Total physical cache bytes (outputs plus sidecars), excluding temp files.

Source

pub fn clear(&self) -> Result<u64>

Remove every cache entry, returning the bytes reclaimed. Idempotent.

Trait Implementations§

Source§

impl Debug for DerivedCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl OutputCache for DerivedCache

Source§

fn get(&self, id: &NodeId) -> Result<Option<Vec<u8>>>

Fetch a cached node output, or None on a miss. A get error is treated as a miss by the caller (the cache is disposable, never authority).
Source§

fn put(&mut self, id: &NodeId, bytes: &[u8]) -> Result<()>

Store a node output. Best-effort: a put error does not fail the materialization.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.