Rust bindings for LMDB - optimized for AIngle
Idiomatic and safe Rust APIs for interacting with the Symas Lightning Memory-Mapped Database (LMDB). This fork is optimized for use within the AIngle distributed systems framework.
- Memory-mapped I/O - Direct memory access for high performance
- ACID transactions - Full transaction support with MVCC
- Zero-copy reads - Access data directly without copying
- Nested transactions - Hierarchical transaction support
- Cursors - Efficient iteration over key-value pairs
- Cross-platform - Linux, macOS, Windows support
[dependencies]
lmdb-rkv = "0.1"use lmdb::{Environment, Database, WriteFlags};
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Open environment
let env = Environment::new()
.set_max_dbs(1)
.open(Path::new("./data"))?;
// Open database
let db = env.open_db(None)?;
// Write transaction
{
let mut txn = env.begin_rw_txn()?;
txn.put(db, b"key", b"value", WriteFlags::empty())?;
txn.commit()?;
}
// Read transaction
{
let txn = env.begin_ro_txn()?;
let value = txn.get(db, b"key")?;
println!("Value: {:?}", String::from_utf8_lossy(value));
}
Ok(())
}| Crate | Description |
|---|---|
lmdb-rkv |
High-level Rust API |
lmdb-rkv-sys |
Low-level FFI bindings |
# Clone with submodules
git clone --recursive https://github.com/ApiliumCode/lmdb-rs-apilium.git
cd lmdb-rs-apilium
# Build
cargo build
# Run tests
cargo testLMDB provides exceptional read performance through memory-mapped files:
| Operation | Performance |
|---|---|
| Read | O(1) - Direct memory access |
| Write | O(log n) - B+ tree insertion |
| Iteration | Sequential disk access |
This crate is part of the AIngle ecosystem - a Semantic DAG framework for IoT and distributed AI applications.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Maintained by Apilium Technologies - Tallinn, Estonia