Expand description
§hd-engine
Merkle DAG engine with incremental invalidation for hyperdocker.
This crate implements the core Merkle DAG data structure that tracks all files in an environment. Each node represents a file or directory with its content hash. When a file changes, the DAG is incrementally invalidated from the changed leaf up to the root, avoiding a full re-hash of the entire tree.
§Key Types
Node- A single node in the Merkle DAG (file or directory)Dag- The full Merkle DAG tree structureFileChange- Represents a detected change to a fileDagDiff- Computed diff between two DAG snapshots
§Example
use hd_engine::{Dag, ingest_tree};
use hd_cas::ContentStore;
use std::path::Path;
let store = ContentStore::open(Path::new("/tmp/cas")).unwrap();
let mut dag = Dag::new(ContentStore::open(Path::new("/tmp/cas")).unwrap());
let result = ingest_tree(Path::new("/my/project"), &[], &[], &store, &mut dag).unwrap();
println!("root hash: {:?}", result.root_hash);Re-exports§
pub use node::Node;pub use dag::Dag;pub use dag::DagError;pub use invalidation::invalidate;pub use invalidation::FileChange;pub use invalidation::InvalidationResult;pub use diff::dag_diff;pub use diff::DagDiff;pub use ingest::ingest_tree;pub use ingest::IngestResult;pub use ingest::IngestError;