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
Source§impl OutputCache for DerivedCache
impl OutputCache for DerivedCache
Source§fn get(&self, id: &NodeId) -> Result<Option<Vec<u8>>>
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<()>
fn put(&mut self, id: &NodeId, bytes: &[u8]) -> Result<()>
Store a node output. Best-effort: a
put error does not fail the
materialization.Source§fn note(&mut self, _note: CacheNote<'_>)
fn note(&mut self, _note: CacheNote<'_>)
Phase 15.6. Advisory, best-effort reuse/store event, reported for every
cache hit and store. The default is a no-op, so
NoCache and
DerivedCache are byte-identical to a build without this method; it is
never on the exactness path and can never change an output.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