1 unstable release
| 0.1.0 | Dec 17, 2025 |
|---|
#1168 in Database interfaces
Used in aingle-rkv
575KB
14K
SLoC
lmdb-rs-apilium
Rust bindings for LMDB - optimized for AIngle
Overview
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.
Features
- 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
Installation
[dependencies]
lmdb-rkv = "0.1"
Quick Start
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(())
}
Crates
| Crate | Description |
|---|---|
lmdb-rkv |
High-level Rust API |
lmdb-rkv-sys |
Low-level FFI bindings |
Building from Source
# Clone with submodules
git clone --recursive https://github.com/ApiliumCode/lmdb-rs-apilium.git
cd lmdb-rs-apilium
# Build
cargo build
# Run tests
cargo test
Performance
LMDB 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 |
Part of AIngle
This crate is part of the AIngle ecosystem - a Semantic DAG framework for IoT and distributed AI applications.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Maintained by Apilium Technologies - Tallinn, Estonia
Dependencies
~155–500KB