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
impl DerivedCache
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self>
pub fn open(root: impl AsRef<Path>) -> Result<Self>
Open (creating if needed) a derived cache rooted at root.
Sourcepub fn get(&self, id: &NodeId) -> Result<Option<Vec<u8>>>
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).
Sourcepub fn put(&mut self, id: &NodeId, bytes: &[u8]) -> Result<u64>
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.
Sourcepub fn contains(&self, id: &NodeId) -> Result<bool>
pub fn contains(&self, id: &NodeId) -> Result<bool>
Whether an output file exists for id (the sidecar is not checked).
Sourcepub fn total_bytes(&self) -> Result<u64>
pub fn total_bytes(&self) -> Result<u64>
Total physical cache bytes (outputs plus sidecars), excluding temp files.
Trait Implementations§
Source§impl Debug for DerivedCache
impl Debug for DerivedCache
Auto Trait Implementations§
impl Freeze for DerivedCache
impl RefUnwindSafe for DerivedCache
impl Send for DerivedCache
impl Sync for DerivedCache
impl Unpin for DerivedCache
impl UnsafeUnpin for DerivedCache
impl UnwindSafe for DerivedCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more