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
impl PromotedStore
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self>
pub fn open(root: impl AsRef<Path>) -> Result<Self>
Open (creating if needed) a promoted store 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 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.
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 remove(&mut self, id: &NodeId) -> Result<u64>
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.
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 promoted bytes (outputs plus sidecars), excluding temp files.
Sourcepub fn output_bytes(&self) -> Result<u64>
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.