# OFilter
[OFilter](https://gitlab.com/liberecofr/ofilter) is an opinionated Bloom filter implemented in [Rust](https://www.rust-lang.org/).
Internally, it uses an existing [bloomfilter](https://github.com/jedisct1/rust-bloom-filter) implementation, which works well, but on top of it, it does 3 things.
First, it uses 2 bloom filters, and switches from one to the other when one of
them is "full". This enable a continuous usage of the filter, without ever worrying
of it being filled. At some point it is a primitive implementation of an
"aging" Bloom filter. But really, it does it in a quick & dirty way. The idea
is just, for a toy project, to keep some cache volume within a "reasonable" range,
but without worrying too much. The idea is just to never skip the latest entries.
Second, it has a thin layer to make it usable in multithreaded environments,
using a standard `RwLock`.
Third, it bakes in some opinionated choices, making it a relative no-brainer
to use, just give the capacity, and call it a day.
Nothing crazy, this is just a helper lib, packing some opinionated choices
over already existing software libraries that work well.

# Status
For now this is a toy project, clearly *NOT* suitable for production use.
[](https://gitlab.com/liberecofr/ofilter/pipelines)
# Usage
```rust
use ofilter::Filter;
let mut filter: Filter<usize> = Filter::new(100);
filter.set(&42);
assert!(filter.check(&42));
```
# Links
* [crate](https://crates.io/crates/ofilter) on crates.io
* [doc](https://docs.rs/ofilter/) on docs.rs
* [source](https://gitlab.com/liberecofr/ofilter/tree/main) on gitlab.com
* [bloomfilter](https://crates.io/crates/bloomfilter) used internally
* [more about](https://freecontent.manning.com/all-about-bloom-filters/]) Bloom filters
# License
OFilter is licensed under the [MIT](https://gitlab.com/liberecofr/ofilter/blob/main/LICENSE) license.