pub struct GovernedCache { /* private fields */ }Expand description
An OutputCache decorator: the durable promoted store is consulted first,
then the mutable disposable DerivedCache. Promotion is decided in
OutputCache::note.
Implementations§
Source§impl GovernedCache
impl GovernedCache
Sourcepub fn open(store_root: impl AsRef<Path>, gov: Governor) -> Result<Self>
pub fn open(store_root: impl AsRef<Path>, gov: Governor) -> Result<Self>
Open the governed cache over a store root: the disposable cache/ plus the
durable promoted/, sharing gov. On the first open of a governor the
durable byte count is reconciled from disk; a store already over budget is
cleared wholesale (the coarse bound ModelMemo uses).
Sourcepub fn promoted(&self) -> &PromotedStore
pub fn promoted(&self) -> &PromotedStore
The durable promoted store (for courts and stats).
Trait Implementations§
Source§impl Debug for GovernedCache
impl Debug for GovernedCache
Source§impl OutputCache for GovernedCache
impl OutputCache for GovernedCache
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 !RefUnwindSafe for GovernedCache
impl !Send for GovernedCache
impl !Sync for GovernedCache
impl !UnwindSafe for GovernedCache
impl Freeze for GovernedCache
impl Unpin for GovernedCache
impl UnsafeUnpin for GovernedCache
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