VennDB Launches Append-Only In-Memory Rust Database for Bit-Flag Queries
VennDB is an append-only in-memory database written in Rust, purpose-built for mostly static datasets loaded at startup and queried constantly with simple bit-flag filters. Originally developed for the rama proxy framework, it has almost no dependencies and benchmarks faster than naive implementations and heavier options like SQLite.
Related Entities
Full Report
Contents2 sections
VennDB
An append-only in-memory database in Rust for rows queried using bit (flag) columns. This database is designed for a very specific use case where you have mostly static data that you typically load at startup and have to query constantly using very simple filters. Datasets like these can be large and should be both fast and compact.
For the limited usecases where venndb can be applied to,
it has next to no dependencies and is faster then traditional choices,
such as a naive implementation or a more heavy lifted dependency such as Sqlite.
See the benchmarks for more information on this topic.
This project was developed originally in function of rama,
where you can see it being used for example to provide an in-memory (upstream) proxy database.
Do let us know in case you use it as well in your project, such that we can assemble a showcase list.
💬 Come join us at Discord on the #venndb public channel. To ask questions, discuss ideas and ask how venndb may be useful for you.
Index
venndb manual:
technical information:
misc:
Usage
Add venndb as a dependency:
cargo add venndband import the derive macro in the module where you want to use it:
use venndb::{Any, VennDB};
#[derive(Debug, VennDB)]
pub struct Employee {
#[venndb(key)]
id: u32,
name: String,
is_manager: Option<bool>,
is_admin: bool,
#[venndb(skip)]
foo: bool,
#[venndb(filter, any)]
department: Department,
#[venndb(filter)]
country: Option<String>,
}
fn main() {
let db = EmployeeDB::from_iter(employees()).expect("unique ids");
let mut query = db.query();
let employee = query
.is_admin(true)
.is_manager(false)
.department(Department::Engineering)
.execute()
.expect("to have found at least one")
.any();
println!("non-manager admin engineer: {:?}", employee);
}See the full example, the examples (the code in this document is taken from these)
or the "Generated Code Summary" chapter below to learn how to use the VennDB and its generated code.
(注:更多技术实现细节与完整 API 文档请查阅原项目 README)