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
impl Store
pub fn at(root: impl Into<PathBuf>) -> Self
pub fn root(&self) -> &Path
Sourcepub fn lay_down(
&self,
manifest_bytes: &[u8],
tools: &[(&str, &[u8])],
) -> Result<String, StoreError>
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.
Sourcepub fn lay_down_payloads(
&self,
manifest_bytes: &[u8],
payloads: &[Payload<'_>],
) -> Result<String, StoreError>
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).
Sourcepub fn list(&self) -> Result<Vec<InstalledLayer>, StoreError>
pub fn list(&self) -> Result<Vec<InstalledLayer>, StoreError>
Every layer present in the core, in stable (digest) order.
Sourcepub fn varve_root(&self) -> PathBuf
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>).
Sourcepub fn partitions(&self) -> Vec<(Option<String>, Store)>
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).
Sourcepub fn find_anywhere(
&self,
digest: &str,
) -> Result<Option<(Store, InstalledLayer)>, StoreError>
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.
pub fn get(&self, digest: &str) -> Result<Option<InstalledLayer>, StoreError>
Sourcepub fn tool_path(&self, layer: &InstalledLayer, tool: &str) -> Option<PathBuf>
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.
Sourcepub fn entry_path(
&self,
layer: &InstalledLayer,
entry: &ManifestEntry,
) -> Option<PathBuf>
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>.
impl Store
Compute the store key for manifest bytes: sha256:<hex>.
Sourcepub fn manifest_tool_names(
&self,
layer: &InstalledLayer,
) -> Result<Vec<String>, StoreError>
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.