ofilter 0.1.1

OFilter is an opinionated Bloom filter.
Documentation

OFilter

OFilter is an opinionated Bloom filter implemented in Rust.

Internally, it uses an existing bloomfilter 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.

In practice, I am using this filter to implement a self-expiring KV store.

OFilter icon

Status

For now this is a toy project, clearly NOT suitable for production use.

Build Status

Usage

use ofilter::Filter;

let mut filter: Filter<usize> = Filter::new(100);
filter.set(&42);
assert!(filter.check(&42));

Links

License

OFilter is licensed under the MIT license.