Skip to main content

cuenv_cache/
lib.rs

1//! Content-addressed task caching for cuenv
2//!
3//! This crate provides the caching infrastructure for cuenv task execution:
4//! - Content-addressed storage based on input file hashes
5//! - Deterministic cache key computation
6//! - Task result serialization and materialization
7//! - Workspace snapshot archiving
8//!
9//! # Overview
10//!
11//! The cache system enables fast task re-execution by storing:
12//! - Task outputs indexed by a deterministic cache key
13//! - Execution metadata (duration, exit code, environment)
14//! - Workspace snapshots for hermetic execution
15//!
16//! # Cache Key Computation
17//!
18//! Cache keys are computed from:
19//! - Input file content hashes
20//! - Command and arguments
21//! - Environment variables
22//! - cuenv version and platform
23
24// TODO(cache-docs): Add # Errors documentation to all fallible public functions
25#![expect(
26    clippy::missing_errors_doc,
27    reason = "Error documentation to be added incrementally"
28)]
29
30mod error;
31pub mod tasks;
32
33// Re-export error types at crate root
34pub use error::{Error, Result};
35
36// Re-export main types
37pub use tasks::{
38    CacheEntry, CacheKeyEnvelope, OutputIndexEntry, SaveResultData, TaskLatestIndex, TaskLogs,
39    TaskResultMeta, compute_cache_key, get_project_cache_keys, key_to_path, lookup, lookup_latest,
40    materialize_outputs, record_latest, save_result, snapshot_workspace_tar_zst,
41};