Skip to main content

GovernedCache

Struct GovernedCache 

Source
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

Source

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).

Source

pub fn promoted(&self) -> &PromotedStore

The durable promoted store (for courts and stats).

Trait Implementations§

Source§

impl Debug for GovernedCache

Source§

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

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

impl OutputCache for GovernedCache

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.
Source§

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§

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.