mappy_core/
lib.rs

1//! # Mappy Core
2//!
3//! Core implementation of maplet data structures for space-efficient approximate key-value mappings.
4//!
5//! Based on the research paper "Time To Replace Your Filter: How Maplets Simplify System Design"
6//! by Bender, Conway, Farach-Colton, Johnson, and Pandey.
7
8pub mod concurrent;
9pub mod deletion;
10pub mod encoding;
11pub mod engine;
12pub mod error;
13pub mod hash;
14pub mod layout;
15pub mod maplet;
16pub mod operators;
17pub mod quotient_filter;
18pub mod resize;
19pub mod storage;
20pub mod ttl;
21pub mod types;
22
23// Re-export main types
24pub use engine::{Engine, EngineConfig, EngineStats};
25pub use maplet::Maplet;
26pub use operators::{
27    CounterOperator, MaxOperator, MergeOperator, MinOperator, SetOperator, StringOperator,
28    VectorOperator,
29};
30pub use storage::{PersistenceMode, Storage, StorageConfig, StorageStats};
31pub use ttl::{TTLConfig, TTLEntry, TTLManager, TTLStats};
32pub use types::{MapletError, MapletResult, MapletStats};
33
34/// Common result type for maplet operations
35pub type Result<T> = std::result::Result<T, MapletError>;
36
37#[cfg(test)]
38mod tests {
39    use super::*;
40
41    #[tokio::test]
42    async fn test_basic_maplet_creation() {
43        let maplet = Maplet::<String, u64, CounterOperator>::new(100, 0.01).unwrap();
44        assert_eq!(maplet.len().await, 0);
45        assert!(maplet.error_rate() <= 0.01);
46    }
47}