Skip to main content

Store

Struct Store 

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

The core store rooted at a directory (defaults to ~/.varve in the CLI; injectable here so tests and future tools own their roots).

Implementations§

Source§

impl Store

Source

pub fn at(root: impl Into<PathBuf>) -> Self

Source

pub fn root(&self) -> &Path

Source

pub fn lay_down( &self, manifest_bytes: &[u8], tools: &[(&str, &[u8])], ) -> Result<String, StoreError>

Lay a layer down in the core from its manifest bytes and tool binaries. Returns the manifest digest (sha256:<hex>) — the store key.

The dispatchable-only convenience over Store::lay_down_payloads, which is the single writer.

Source

pub fn lay_down_payloads( &self, manifest_bytes: &[u8], payloads: &[Payload<'_>], ) -> Result<String, StoreError>

Lay a layer down in the core from its manifest bytes and its payloads. Returns the manifest digest (sha256:<hex>) — the store key.

This is the write path shared by the installer and by tests; nothing else writes to the core. Two payloads that would land on ONE path are refused (StoreError::Collision) rather than written in turn: relaxing the deposit-time identity check without this would turn a clean error into silent data loss — the second entry’s bytes under the first’s name, with verification then failing on the other entry and nothing explaining why (REQ-STORE-002).

Source

pub fn list(&self) -> Result<Vec<InstalledLayer>, StoreError>

Every layer present in the core, in stable (digest) order.

Source

pub fn varve_root(&self) -> PathBuf

Look up a layer by manifest digest (sha256:<hex>). The varve root this store lives under: itself, or the parent of a realm partition (<root>/realms/<fingerprint>).

Source

pub fn partitions(&self) -> Vec<(Option<String>, Store)>

Every partition under this varve root: the top-level core first, then each realm partition in a stable order, paired with the realm fingerprint that names it (None for the top-level core, which is not realm-scoped).

find_anywhere had this enumeration inline and private, so a caller that needed to WALK the store rather than look one digest up had no way to do it — which is how verify --all came to check only the pinned realm’s partition while its --help promised every installed layer (REQ-VERIFYALL-001, varve#84).

Source

pub fn find_anywhere( &self, digest: &str, ) -> Result<Option<(Store, InstalledLayer)>, StoreError>

Find a layer by digest in ANY partition under this varve root — the top-level core or any realm’s. A digest is content-addressed, so where it happens to live does not change what it is; a cross-realm composition include is installed under the INCLUDED realm’s fingerprint, not the including project’s, and looking only in one partition reported it as missing while list showed it installed (REQ-STORE-001).

Locating a layer is not accepting it: the caller still verifies it against the trust root of the realm that vouches for it.

Source

pub fn get(&self, digest: &str) -> Result<Option<InstalledLayer>, StoreError>

Source

pub fn tool_path(&self, layer: &InstalledLayer, tool: &str) -> Option<PathBuf>

Path of one tool’s binary within an installed layer, if present. Dispatch is by name, so this takes a bare name — see entry_path for payloads that are held rather than dispatched.

Source

pub fn entry_path( &self, layer: &InstalledLayer, entry: &ManifestEntry, ) -> Option<PathBuf>

Path of the bytes one MANIFEST ENTRY refers to within an installed layer, if present. This is the read side of lay_down_payloads, and every consumer of a layer’s bytes (verify, archive, the export adapters) goes through it so the two cannot drift.

Backward compatibility: a layer installed BEFORE REQ-STORE-002 holds its crates at bin/<name>, so a versioned payload that is not at its versioned path falls back there. Such a layer can hold only one version per name — the old deposit check made sure of it — so the fallback is unambiguous.

Source§

impl Store

Compute the store key for manifest bytes: sha256:<hex>.

Source

pub fn manifest_tool_names( &self, layer: &InstalledLayer, ) -> Result<Vec<String>, StoreError>

Every tool name the layer’s SIGNED manifest carries, whatever this host laid down. Used to tell “the pin asks for something that was never in this layer” apart from “the install is incomplete” — the two need opposite advice, and conflating them produced an error whose stated fix could not work.

Trait Implementations§

Source§

impl Clone for Store

Source§

fn clone(&self) -> Store

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Store

Source§

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

Formats the value using the given formatter. Read more

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more