Grafite
Grafite is a range filter with a simple design and clear theoretical guarantees that hold regardless of the input data and query distribution.
This library is a Rust implementation of the data structure introduced by this paper: Grafite: Taming Adversarial Queries with Optimal Range Filters.
The authors of this paper also created a C++ implementation for Grafite, which can be found on one of the author's GitHub: grafite.
The Grafite data structure relies on the Elias-Fano encoding of non-decreasing integer sequences, and this library uses the [vers_vecs] implementation of the encoding.
Examples
use ;
let values = ;
let epsilon = 0.01;
let max_query_range = 20;
let hasher = new
.expect;
let rf = new;
// If there are any values in the range, it will return `true`.
assert!;
assert!;
assert!;
assert!;
// Start is inclusive.
assert!;
assert!;
// End is exclusive. Note that false positives are possible depending on the input `epsilon`.
assert!;
assert!;