pub struct ArtifactCacheSpec { /* private fields */ }Expand description
Complete caller-owned description of one transactional artifact set.
Declared inputs and tools must not be located inside cache_root. Output
destinations must remain outside it, resolve to distinct non-nested paths,
and not overlap a declared input or tool. Cargo-derived cache/output paths must
likewise remain outside resolved inputs unless covered by their exact
generated-state exclusions.
Implementations§
Source§impl ArtifactCacheSpec
impl ArtifactCacheSpec
Sourcepub fn new(cache_root: &Path, namespace: &str, recipe_id: &str) -> Self
pub fn new(cache_root: &Path, namespace: &str, recipe_id: &str) -> Self
Describe one external artifact recipe using non-secret stable identifiers.
The namespace selects an independent content store. recipe_id must be
bumped whenever undeclared pipeline semantics change. The default
coordination scope is the namespace.
Sourcepub fn with_coordination_scope(self, coordination_scope: &str) -> Self
pub fn with_coordination_scope(self, coordination_scope: &str) -> Self
Serialize recipes that share caller-owned mutable external build state.
Sourcepub fn with_input(self, label: &str, path: &Path) -> Self
pub fn with_input(self, label: &str, path: &Path) -> Self
Add one exact input file or directory outside the cache root under a stable label.
Sourcepub fn with_tool(self, label: &str, path: &Path) -> Self
pub fn with_tool(self, label: &str, path: &Path) -> Self
Add one exact executable or tool path outside the cache root under a stable label.
Sourcepub fn with_arguments<I, S>(self, arguments: I) -> Self
pub fn with_arguments<I, S>(self, arguments: I) -> Self
Set OS-native ordered command arguments that contribute to the content key.
Sourcepub fn with_environment<I, K, V>(self, environment: I) -> Self
pub fn with_environment<I, K, V>(self, environment: I) -> Self
Set OS-native environment values that contribute to the content key.
This records identity only. The caller must apply these values to the external command executed on a cache miss.
Sourcepub fn with_unset_environment<I, S>(self, names: I) -> Self
pub fn with_unset_environment<I, S>(self, names: I) -> Self
Record OS-native environment names whose unset state contributes to the content key.
The caller must also remove these names from the external command’s environment on a cache miss.
Sourcepub fn with_identity_bytes(self, label: &str, value: &[u8]) -> Self
pub fn with_identity_bytes(self, label: &str, value: &[u8]) -> Self
Add opaque non-secret identity bytes under a stable logical label.
Labels are stored in canonical order; declaration order does not affect identity.
Sourcepub fn with_cargo_build_inputs(
self,
label: &str,
build_spec: &WasmBuildSpec,
resolved: &ResolvedCargoBuildInputs,
) -> Self
pub fn with_cargo_build_inputs( self, label: &str, build_spec: &WasmBuildSpec, resolved: &ResolvedCargoBuildInputs, ) -> Self
Add one exact Cargo input snapshot as transactional cache identity and guard.
The semantic resolved fingerprint keys toolchain, arguments, environment and the selected dependency closure. Its conservative Cargo-aware validation paths and exclusions are rehashed automatically during preparation, cache-hit materialization and transaction commit. Labels are stored in canonical order; declaration order does not affect identity.
Sourcepub fn with_output(self, name: &str, destination: &Path) -> Self
pub fn with_output(self, name: &str, destination: &Path) -> Self
Declare one nonempty regular-file output and its nonoverlapping public destination.
Sourcepub fn with_output_validation(
self,
name: &str,
destination: &Path,
validation: ArtifactOutputValidation,
) -> Self
pub fn with_output_validation( self, name: &str, destination: &Path, validation: ArtifactOutputValidation, ) -> Self
Declare one output, nonoverlapping public destination, and validation policy.
Sourcepub const fn with_prune_policy(self, policy: ArtifactCachePrunePolicy) -> Self
pub const fn with_prune_policy(self, policy: ArtifactCachePrunePolicy) -> Self
Apply best-effort retention while protecting the acquired entry.
Sourcepub const fn with_prune_policy_at_most_every(
self,
policy: ArtifactCachePrunePolicy,
minimum_interval: Duration,
) -> Self
pub const fn with_prune_policy_at_most_every( self, policy: ArtifactCachePrunePolicy, minimum_interval: Duration, ) -> Self
Apply retention at most once per minimum_interval for this namespace.
The small due-marker check still occurs under the namespace lock.
Successful acquisitions skip the directory scan until the interval has
elapsed. The interval applies to attempted maintenance, including a
nonfatal failed attempt. A zero interval is equivalent to
Self::with_prune_policy.
Sourcepub fn cache_root(&self) -> &Path
pub fn cache_root(&self) -> &Path
Caller-selected root containing cache data and coordination locks.