graphos_core/storage/mod.rs
1//! Storage utilities for graph data.
2//!
3//! This module provides compression and encoding utilities:
4//!
5//! - [`dictionary`] - Dictionary encoding for strings with low cardinality
6//! - [`delta`] - Delta encoding for sorted integer sequences
7//! - [`bitpack`] - Bit-packing for small integers
8//! - [`bitvec`] - Bit vector for boolean compression
9//! - [`codec`] - Unified compression codec interface
10//!
11//! # Compression Strategies
12//!
13//! | Data Type | Recommended Codec | Compression Ratio |
14//! |-----------|-------------------|-------------------|
15//! | Sorted integers | DeltaBitPacked | 5-20x |
16//! | Small integers | BitPacked | 2-16x |
17//! | Strings (low cardinality) | Dictionary | 2-50x |
18//! | Booleans | BitVector | 8x |
19//!
20//! # Example
21//!
22//! ```ignore
23//! use graphos_core::storage::{TypeSpecificCompressor, CodecSelector};
24//!
25//! // Compress sorted integers
26//! let values: Vec<u64> = (100..200).collect();
27//! let compressed = TypeSpecificCompressor::compress_integers(&values);
28//! println!("Compression ratio: {:.1}x", compressed.compression_ratio());
29//!
30//! // Compress booleans
31//! let bools = vec![true, false, true, true, false];
32//! let compressed = TypeSpecificCompressor::compress_booleans(&bools);
33//! ```
34
35pub mod bitpack;
36pub mod bitvec;
37pub mod codec;
38pub mod delta;
39pub mod dictionary;
40
41// Re-export commonly used types
42pub use bitpack::{BitPackedInts, DeltaBitPacked};
43pub use bitvec::BitVector;
44pub use codec::{
45 CodecSelector, CompressedData, CompressionCodec, CompressionMetadata, TypeSpecificCompressor,
46};
47pub use delta::{DeltaEncoding, zigzag_decode, zigzag_encode};
48pub use dictionary::{DictionaryBuilder, DictionaryEncoding};