Skip to main content

hexz_cli/cmd/data/
mod.rs

1//! Data operation commands for archive management.
2//!
3//! This module provides commands for creating, inspecting, and analyzing Hexz
4//! archives. Archives (`.st` files) are the primary storage format for snapshots,
5//! containing compressed, deduplicated, and optionally encrypted data.
6//!
7//! # Available Commands
8//!
9//! - [`pack`]: Create archives from raw disk images or memory dumps
10//! - [`build`]: Build archives from source directories with profiles
11//! - [`info`]: Inspect archive metadata (header, index, compression stats)
12//! - [`diff`]: Show block/file-level differences in overlays (diagnostics)
13//! - [`analyze`]: Run DCAM analysis to optimize CDC parameters (diagnostics)
14//!
15//! # Workflow Example
16//!
17//! ```bash
18//! # 1. Analyze optimal parameters
19//! hexz data analyze disk.img
20//!
21//! # 2. Pack with optimized settings
22//! hexz data pack --disk disk.img --output snapshot.st --cdc \
23//!   --min-chunk 8192 --avg-chunk 32768
24//!
25//! # 3. Inspect the result
26//! hexz data info snapshot.st --json
27//! ```
28//!
29//! # Archive Format
30//!
31//! Archives consist of:
32//! - **Header**: Magic bytes, version, flags, encryption metadata
33//! - **Index**: B-tree or hash-based block index for fast lookups
34//! - **Data**: Compressed, deduplicated blocks
35//! - **Signature**: Optional Ed25519 signature (if signing enabled)
36//!
37//! # Performance Considerations
38//!
39//! - **CDC vs Fixed**: CDC provides better deduplication but slower packing
40//! - **Compression**: LZ4 is faster, Zstandard has higher ratios
41//! - **Dictionary Training**: Improves Zstandard compression by 10-30%
42//! - **Block Size**: Larger blocks = less overhead, worse deduplication
43
44pub mod info;
45pub mod pack;
46
47#[cfg(feature = "diagnostics")]
48pub mod diff;
49
50#[cfg(feature = "diagnostics")]
51pub mod analyze;
52
53pub mod build;
54
55pub mod convert;