Skip to main content

OutputCache

Trait OutputCache 

Source
pub trait OutputCache {
    // Required methods
    fn get(&self, id: &NodeId) -> Result<Option<Vec<u8>>>;
    fn put(&mut self, id: &NodeId, bytes: &[u8]) -> Result<()>;
}
Expand description

A node-output cache keyed by NodeId. Because a node’s id binds its full dependency closure, an unchanged closure hits and a changed dependency misses; there is no invalidation pass (ADR-0025).

Implementations are disposable: materialize_node_cached treats any get error as a miss and never trusts bytes it cannot validate, so a corrupt cache causes recomputation rather than wrong output.

Required Methods§

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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§