pub struct WatchedInputSnapshot { /* private fields */ }Expand description
Exact content digest captured across a set of watched input trees.
This lightweight freshness helper records input identity only. It does not
lock producers, validate output content, or retain artifact paths. Use
super::ArtifactCacheSpec for transactional publication and retained outputs.
Implementations§
Source§impl WatchedInputSnapshot
impl WatchedInputSnapshot
Sourcepub fn capture(
workspace_root: &Path,
watched_relative_paths: &[&str],
) -> Result<Self>
pub fn capture( workspace_root: &Path, watched_relative_paths: &[&str], ) -> Result<Self>
Recursively hash the paths and contents of all watched inputs.
File timestamps are deliberately excluded, so the same content produces the same digest after a Git checkout or CI cache restore.
§Errors
Returns input traversal or file-read errors while hashing the watched trees.
Sourcepub const fn digest(self) -> InputDigest
pub const fn digest(self) -> InputDigest
Return the exact content digest of the watched inputs.
Sourcepub fn artifact_is_fresh(self, artifact_path: &Path) -> Result<bool>
pub fn artifact_is_fresh(self, artifact_path: &Path) -> Result<bool>
Check whether one artifact carries a matching exact-input stamp.
An existing artifact without a stamp is not considered fresh. Call
mark_artifact_fresh only after the
artifact has been produced successfully from this snapshot.
Output bytes are not hashed; a replaced nonempty artifact can still
carry the same matching input stamp.
Stamp reads are bounded by the expected stamp length plus one byte;
oversized stamps are stale. I/O errors and invalid UTF-8 in stamps within
that size limit are reported to the caller.
§Errors
Returns artifact metadata, bounded stamp-read or stamp UTF-8 errors. An absent stamp is stale rather than an error; absent artifacts report I/O errors.
Sourcepub fn mark_artifact_fresh(self, artifact_path: &Path) -> Result<()>
pub fn mark_artifact_fresh(self, artifact_path: &Path) -> Result<()>
Atomically record that an existing artifact was built from this input snapshot.
The caller must coordinate producers and verify that inputs have not changed during the build before stamping. This checks only that the artifact is a nonempty regular file, not that its bytes match the build.
§Errors
Returns artifact metadata, invalid-artifact or durable stamp-publication errors.