Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sile/scalable_cuckoo_filter
A variant of Cuckoo Filter whose size automatically scales as necessary
https://github.com/sile/scalable_cuckoo_filter
bloom-filter cuckoo-filter data-structure rust
Last synced: about 2 months ago
JSON representation
A variant of Cuckoo Filter whose size automatically scales as necessary
- Host: GitHub
- URL: https://github.com/sile/scalable_cuckoo_filter
- Owner: sile
- License: mit
- Created: 2018-01-16T12:55:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-24T08:25:39.000Z (8 months ago)
- Last Synced: 2024-05-01T23:47:29.987Z (8 months ago)
- Topics: bloom-filter, cuckoo-filter, data-structure, rust
- Language: Rust
- Homepage:
- Size: 82 KB
- Stars: 16
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
scalable_cuckoo_filter
======================[![scalable_cuckoo_filter](https://img.shields.io/crates/v/scalable_cuckoo_filter.svg)](https://crates.io/crates/scalable_cuckoo_filter)
[![Documentation](https://docs.rs/scalable_cuckoo_filter/badge.svg)](https://docs.rs/scalable_cuckoo_filter)
[![Actions Status](https://github.com/sile/scalable_cuckoo_filter/workflows/CI/badge.svg)](https://github.com/sile/scalable_cuckoo_filter/actions)
[![Coverage Status](https://coveralls.io/repos/github/sile/scalable_cuckoo_filter/badge.svg?branch=master)](https://coveralls.io/github/sile/scalable_cuckoo_filter?branch=master)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)A variant of [Cuckoo Filter][cuckoo filter] whose size automatically scales as necessary.
[Documentation](https://docs.rs/scalable_cuckoo_filter)
Examples
--------Basic usage:
```rust
use scalable_cuckoo_filter::ScalableCuckooFilter;let mut filter = ScalableCuckooFilter::new(100, 0.001);
assert!(!filter.contains("foo"));
filter.insert("foo");
assert!(filter.contains("foo"));
```Filter grows automatically:
```rust
use scalable_cuckoo_filter::ScalableCuckooFilter;let mut filter = ScalableCuckooFilter::new(100, 0.001);
assert_eq!(filter.capacity(), 128);for i in 0..1000 {
filter.insert(&i);
}
assert_eq!(filter.capacity(), 1923);
```Filter shrinking:
```rust
use scalable_cuckoo_filter::ScalableCuckooFilter;let mut filter = ScalableCuckooFilter::new(1000, 0.001);
for i in 0..100 {
filter.insert(&i);
}
assert_eq!(filter.capacity(), 1024);
assert_eq!(filter.bits(), 14336);filter.shrink_to_fit();
for i in 0..100 {
assert!(filter.contains(&i));
}
assert_eq!(filter.capacity(), 128);
assert_eq!(filter.bits(), 1792);
```References
----------- [Cuckoo Filter: Practically Better Than Bloom][cuckoo filter]
- [Scalable Bloom Filters][scalable bloom filters][cuckoo filter]: https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf
[scalable bloom filters]: http://haslab.uminho.pt/cbm/files/dbloom.pdf