pub struct Store { /* private fields */ }Expand description
Handle to an on-disk OCI-layout store.
Implementations§
Source§impl Store
impl Store
Sourcepub fn open(root: &Path) -> Result<Self, StoreError>
pub fn open(root: &Path) -> Result<Self, StoreError>
Open (and initialize) a store at root.
pub fn root(&self) -> &Path
Sourcepub fn put_component(
&self,
wasm: &[u8],
config_bytes: Option<&[u8]>,
provenance: &Provenance,
) -> Result<Stored, StoreError>
pub fn put_component( &self, wasm: &[u8], config_bytes: Option<&[u8]>, provenance: &Provenance, ) -> Result<Stored, StoreError>
Store a component: write the wasm layer + config blobs, synthesize the
OCI manifest, and upsert its descriptor (with provenance annotations)
into index.json. config_bytes is the act:component CBOR metadata
(or None for an empty config). Holds the exclusive lock.
Sourcepub fn put_oci_artifact(
&self,
manifest_bytes: &[u8],
blobs: &[(String, Vec<u8>)],
provenance: &Provenance,
) -> Result<Stored, StoreError>
pub fn put_oci_artifact( &self, manifest_bytes: &[u8], blobs: &[(String, Vec<u8>)], provenance: &Provenance, ) -> Result<Stored, StoreError>
Store an OCI artifact whose manifest already exists upstream, verbatim:
write manifest_bytes and every blob in blobs content-addressed, then
upsert an index descriptor pointing at the manifest’s own digest (so the
upstream digest — which signatures are computed over — is preserved).
blobs are (expected_hex, bytes) for the config and every layer.
Holds the exclusive lock.
Sourcepub fn put_referrer(
&self,
manifest_bytes: &[u8],
blobs: &[(String, Vec<u8>)],
subject_digest: &str,
artifact_type: Option<&str>,
) -> Result<String, StoreError>
pub fn put_referrer( &self, manifest_bytes: &[u8], blobs: &[(String, Vec<u8>)], subject_digest: &str, artifact_type: Option<&str>, ) -> Result<String, StoreError>
Store a connected artifact (referrer) verbatim: write its manifest +
blobs content-addressed and index it with dev.actcore.referrer.subject
(= subject_digest, a sha256:... string) and dev.actcore.referrer.kind
annotations + artifactType. Deduped by referrer manifest digest. Returns
the referrer manifest hex. Holds the exclusive lock.
Sourcepub fn list_referrers_by_digest(
&self,
subject_hex: &str,
) -> Result<Vec<ReferrerInfo>, StoreError>
pub fn list_referrers_by_digest( &self, subject_hex: &str, ) -> Result<Vec<ReferrerInfo>, StoreError>
List referrers attached to the component manifest with hex digest
subject_hex (no sha256: prefix).
Sourcepub fn list_referrers(
&self,
component_ref: &str,
kind_filter: Option<&str>,
) -> Result<Vec<ReferrerInfo>, StoreError>
pub fn list_referrers( &self, component_ref: &str, kind_filter: Option<&str>, ) -> Result<Vec<ReferrerInfo>, StoreError>
List referrers attached to the component identified by component_ref
(source ref as typed). Empty if the component is not stored.
Sourcepub fn resolve(&self, reference: &str) -> Result<Option<PathBuf>, StoreError>
pub fn resolve(&self, reference: &str) -> Result<Option<PathBuf>, StoreError>
Resolve a stored component by its source ref to the path of its wasm
layer blob. Returns Ok(None) if not present. Holds a shared lock.
Sourcepub fn list(&self) -> Result<Vec<Stored>, StoreError>
pub fn list(&self) -> Result<Vec<Stored>, StoreError>
List every stored component with its provenance. Holds a shared lock. Descriptors with unparseable annotations are skipped (defensive).
Sourcepub fn gc(&self) -> Result<usize, StoreError>
pub fn gc(&self) -> Result<usize, StoreError>
Delete blobs not reachable from index.json. Returns the count
removed. Holds the exclusive lock.