Skip to main content

PromotedStore

Struct PromotedStore 

Source
pub struct PromotedStore { /* private fields */ }
Expand description

A durable, content-addressed, budgeted store of promoted intermediates.

Same atomic layout as DerivedCache but under <root>/promoted/: a <64-hex> output file plus a <64-hex>.b3 BLAKE3 sidecar, verified on read.

Implementations§

Source§

impl PromotedStore

Source

pub fn open(root: impl AsRef<Path>) -> Result<Self>

Open (creating if needed) a promoted store rooted at root.

Source

pub fn root(&self) -> &Path

The store root directory.

Source

pub fn get(&self, id: &NodeId) -> Result<Option<Vec<u8>>>

Fetch a promoted output, verifying the sidecar digest.

  • absent bytes or absent sidecar -> Ok(None) (a miss).
  • sidecar present but not BLAKE3(bytes) -> crate::ErrorClass::IntegrityMismatch (fail closed; never return wrong bytes). The DAG treats the error as a miss and recomputes, so a poisoned entry cannot change an answer.
Source

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.

Source

pub fn remove(&mut self, id: &NodeId) -> Result<u64>

Remove one promoted entry (output plus sidecar), returning the physical bytes reclaimed. Idempotent: an absent entry reclaims nothing.

Source

pub fn contains(&self, id: &NodeId) -> Result<bool>

Whether an output file exists for id (the sidecar is not checked).

Source

pub fn total_bytes(&self) -> Result<u64>

Total physical promoted bytes (outputs plus sidecars), excluding temp files.

Source

pub fn output_bytes(&self) -> Result<u64>

Sum of output file lengths only (excluding the .b3 sidecars). This is the unit the promotion byte budget is expressed in.

Source

pub fn clear(&mut self) -> Result<u64>

Remove every promoted entry, returning the physical bytes reclaimed. Idempotent.

Trait Implementations§

Source§

impl Debug for PromotedStore

Source§

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

Formats the value using the given formatter. Read more

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.