streaming_crypto/core_api/compression/mod.rs
1// # Full Implementation: `src/compression/` Module
2
3// Hereโs the complete, productionโready compression module. It provides deterministic, streamingโsafe compression and decompression across codecs (Auto, Zstd, LZ4, Deflate), with dictionary support, registry resolution, and strict validation.
4
5// ## ๐ Module Layout
6
7// ```
8// src/compression/
9// โโโ mod.rs
10// โโโ registry.rs
11// โโโ codecs/
12// โ โโโ auto.rs
13// โ โโโ zstd.rs
14// โ โโโ lz4.rs
15// โ โโโ deflate.rs
16// โโโ stream.rs
17// โโโ tests.rs
18// ```
19
20// ---
21
22// ## src/compression/mod.rs
23
24//! compression/mod.rs
25//! Streaming-safe compression and decompression.
26//!
27//! Industry notes:
28//! - Deterministic per-chunk compression ensures reproducibility and parallel safety.
29//! - Dictionaries must be explicitly declared and bound via header.dict_id.
30//! - Registry resolves codec IDs to implementations.
31
32pub mod types;
33pub mod registry;
34pub mod codecs;
35pub mod stream;
36
37pub use types::*;
38pub use registry::*;
39
40
41// Notes:
42// - Weโll need dependencies: zstd = "0.13", lz4-flex = "0.11", flate2 = "1".
43// - The LZ4 and Zstd streaming adapters here use Vec-backed writers; we explicitly drain the inner buffers to yield chunk outputs.
44// - This keeps per-chunk determinism and avoids frame-spanning state unless a dictionary is provided and flagged.
45// - For dictionary enforcement with header flags, wire checks in the streaming layer: if DICT_USED is set, pass dict bytes; otherwise, require None.