Skip to main content

Crate snapdir_core

Crate snapdir_core 

Source
Expand description

snapdir core library.

Manifest format, BLAKE3 merkle hashing, store trait, directory walk, and cache live here. Per the library-purity principle, this crate performs no terminal I/O and reads no $HOME/config/environment for behavior: inputs arrive as parameters and errors surface as typed thiserror enums.

The manifest module owns the frozen manifest line format (PATH_TYPE PERMISSIONS CHECKSUM SIZE PATH) and its (de)serialization. The merkle module owns the directory checksum rule (sort + dedup + concat + re-hash of the direct children’s checksums), the snapshot id (snapshot_id — BLAKE3 of the comment-stripped manifest text, distinct from the root directory checksum), and the Hasher abstraction with its in-process Blake3Hasher, keyed Blake3KeyedHasher (SNAPDIR_MANIFEST_CONTEXT), Md5Hasher and Sha256Hasher (--checksum-bin) implementations. The excludes module owns the %system%/%common% expansion, the grep -E -v matcher, and the follow/no-follow option semantics.

Re-exports§

pub use cache::check_manifest_integrity;
pub use cache::check_snapshot_integrity;
pub use cache::flush_cache;
pub use cache::load_cached_manifest;
pub use cache::verify_cache;
pub use cache::CacheError;
pub use cache::CacheReport;
pub use excludes::expand_excludes;
pub use excludes::ExcludeError;
pub use excludes::ExcludeMatcher;
pub use excludes::ExpandedExclude;
pub use excludes::FollowMode;
pub use excludes::COMMON_EXCLUDE_DIRS;
pub use excludes::SYSTEM_EXCLUDE_DIRS;
pub use manifest::Manifest;
pub use manifest::ManifestEntry;
pub use manifest::ParseError;
pub use manifest::PathType;
pub use merkle::directory_checksum;
pub use merkle::snapshot_id;
pub use merkle::Blake3Hasher;
pub use merkle::Blake3KeyedHasher;
pub use merkle::Hasher;
pub use merkle::Md5Hasher;
pub use merkle::Sha256Hasher;
pub use store::manifest_path;
pub use store::object_path;
pub use store::Store;
pub use store::StoreError;
pub use store::MANIFESTS_DIR;
pub use store::OBJECTS_DIR;
pub use walk::walk;
pub use walk::PathMode;
pub use walk::WalkError;
pub use walk::WalkOptions;

Modules§

cache
XDG content-addressable cache with the cache-id integrity-check mechanism.
excludes
Exclude-pattern expansion and matching, plus the follow/no-follow setting.
manifest
Manifest line format model and (de)serialization.
merkle
Directory checksum (merkle) computation over manifest entries.
store
Storage backend abstraction and the content-addressable path layout.
walk
In-process filesystem walk producing a frozen-format Manifest.