| Crates.io | expandable-cuckoo-filter |
| lib.rs | expandable-cuckoo-filter |
| version | 0.1.0 |
| created_at | 2025-12-27 12:18:30.027029+00 |
| updated_at | 2025-12-27 12:18:30.027029+00 |
| description | A high-performance, persistent, and auto-expanding Cuckoo Filter with deterministic orthogonality. |
| homepage | |
| repository | https://github.com/transilluminate/expandable-cuckoo |
| max_upload_size | |
| id | 2007123 |
| size | 51,290 |
A high-performance, persistent, and auto-expanding Cuckoo Filter for Rust.
export and import methods using raw byte serialization (no compression bloat).node_id based seeding strategy to ensure that filters for different nodes generate uncorrelated false positives.RwLock for concurrent access.proptest for set semantics and persistence roundtrips.Unlike Bloom filters, Cuckoo filters support deletion without significant overhead and typically offer higher space efficiency for low false-positivity rates. This implementation adds dynamic sizing, solving the "fixed capacity" limitation of standard Cuckoo filters.
use expandable_cuckoo_filter::ExpandableCuckooFilter;
// Create a new filter with a unique node ID and initial capacity
let filter = ExpandableCuckooFilter::new("node-1", 1000);
// Insert items
filter.insert("hello");
filter.insert("world");
// Check presence
assert!(filter.contains("hello"));
// Remove items
filter.remove("hello");
assert!(!filter.contains("hello"));
// Persistence
let bytes = filter.export().unwrap();
let restored = ExpandableCuckooFilter::new("node-1", 1000);
restored.import(&bytes).unwrap();
This crate "patches" the standard cuckoofilter behavior by salting keys with a stable seed derived from the node_id. This prevents "zombie filters" and is the foundation for the orthogonal-cuckoo consensus system. This double hashing adds approx 18ns per operation (benchmarks show 23.7ns / operation for the raw CuckooFilter and 41.3ns / operation for ExpandableCuckooFilter).