pub struct Datastore { /* private fields */ }Implementations§
Source§impl Datastore
impl Datastore
pub fn builder() -> DatastoreBuilder
pub fn cache_root(&self) -> &Path
Sourcepub fn max_bytes(&self) -> Option<u64>
pub fn max_bytes(&self) -> Option<u64>
The configured cache budget, if any. Enforced only by gc.
Sourcepub fn get(&self, artifact: &Artifact) -> Result<PathBuf>
pub fn get(&self, artifact: &Artifact) -> Result<PathBuf>
Resolve to a local path, fetching through the chain if needed.
Sourcepub fn get_with_outcome(
&self,
artifact: &Artifact,
) -> Result<(PathBuf, ResolveOutcome)>
pub fn get_with_outcome( &self, artifact: &Artifact, ) -> Result<(PathBuf, ResolveOutcome)>
As get, reporting which layer served it.
Sourcepub fn get_bytes(&self, artifact: &Artifact) -> Result<Vec<u8>>
pub fn get_bytes(&self, artifact: &Artifact) -> Result<Vec<u8>>
Read fully into memory. For small artifacts only.
Sourcepub fn import(&self, artifact: &Artifact, path: &Path) -> Result<PathBuf>
pub fn import(&self, artifact: &Artifact, path: &Path) -> Result<PathBuf>
Seed the cache from a file already on disk, validating it exactly as a download would be. The file is copied, not moved.
Sourcepub fn peek(&self, key: &ArtifactKey) -> Option<PathBuf>
pub fn peek(&self, key: &ArtifactKey) -> Option<PathBuf>
Local path if already cached; never fetches and never rehashes.
pub fn contains(&self, key: &ArtifactKey) -> bool
Sourcepub fn entry(&self, key: &ArtifactKey) -> Option<IndexEntry>
pub fn entry(&self, key: &ArtifactKey) -> Option<IndexEntry>
The index sidecar for key, if cached.
pub fn remove(&self, key: &ArtifactKey) -> Result<()>
pub fn keys(&self) -> Result<Vec<ArtifactKey>>
Sourcepub fn total_bytes(&self) -> Result<u64>
pub fn total_bytes(&self) -> Result<u64>
Bytes on disk across all blobs, orphans included; shared blobs count once.
Sourcepub fn verify(&self) -> Result<Vec<VerifyFailure>>
pub fn verify(&self) -> Result<Vec<VerifyFailure>>
Rehash every blob; report keys whose blob is missing, hashes to a
different digest, or has a size that disagrees with the sidecar.
These are the index-integrity checks get makes on a hit; the
artifact’s own ContentCheck needs an Artifact and is not run here.
Sourcepub fn gc(&self, max_bytes: u64) -> Result<Vec<ArtifactKey>>
pub fn gc(&self, max_bytes: u64) -> Result<Vec<ArtifactKey>>
Reclaim space: first orphan blobs, then the least-recently-fetched
keys until the store is within max_bytes. Explicit only: nothing is
evicted during get, so a path handed out earlier stays valid until
the caller chooses to run this. tmp/ is left alone: a temp file’s
age says nothing about whether its transfer is still running, so
leftovers from a crash are for the operator to remove.