Skip to main content

Store

Struct Store 

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

The content-addressed store rooted at $VANTA_HOME.

Implementations§

Source§

impl Store

Source

pub fn open(home: impl AsRef<Path>) -> VtaResult<Store>

Open (creating the directory skeleton if needed) a store at home.

Source

pub fn store_dir(&self) -> PathBuf

Source

pub fn downloads_dir(&self) -> PathBuf

Source

pub fn envs_dir(&self) -> PathBuf

Source

pub fn entry_path(&self, key: &StoreKey) -> PathBuf

The directory a store key occupies.

Source

pub fn has(&self, key: &StoreKey) -> bool

Whether the store already contains an entry for key.

Source

pub fn new_staging(&self) -> VtaResult<PathBuf>

Create a fresh, unique staging directory under the store. The installer unpacks into it, then calls Store::publish_tree.

Source

pub fn publish_tree(&self, staged: &Path) -> VtaResult<StoreKey>

Publish a staged tree into the store, content-addressed and atomically. If an identical entry already exists, the staged copy is discarded (dedup) and the existing key returned.

Source

pub fn remove_entry(&self, key: &StoreKey) -> VtaResult<()>

Remove a store entry (used when a store hit fails re-verification, audit H4). No-op if the entry is absent.

Source

pub fn verify_entry(&self, key: &StoreKey) -> VtaResult<bool>

Re-hash an entry and confirm it still matches its key (integrity check).

Source

pub fn cache_put_blob(&self, bytes: &[u8]) -> VtaResult<String>

Store a downloaded blob in the content-addressed download cache, returning its blake3-<hex> cache key. Idempotent.

Source

pub fn cache_get_path(&self, cache_key: &str) -> Option<PathBuf>

The path of a cached blob, if present.

Source

pub fn gc(&self, roots: &HashSet<StoreKey>) -> VtaResult<usize>

Garbage-collect: remove every store entry not reachable from roots, plus stale staging dirs. Returns the number of entries removed.

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.