Status
Phase 3. This crate now provides closure-based transactions with atomic batch writes on top of file-backed persistence and crash recovery. The API is still pre-1.0 and may change before 1.0.
Track progress and roadmap: https://github.com/jamesgober/emdb-rs
Installation
[]
= "0.4"
Quick Start
use Emdb;
let mut db = open_in_memory;
db.insert?;
assert_eq!;
# Ok::
Persistence
use ;
let path = temp_dir.join;
let reopened = open?;
assert_eq!;
# let _cleanup = remove_file;
# Ok::
Manual compaction:
use Emdb;
let path = temp_dir.join;
let mut db = open?;
db.insert?;
db.compact?;
db.flush?;
# let _cleanup = remove_file;
# Ok::
Transactions
Commit path:
use Emdb;
let mut db = open_in_memory;
db.transaction?;
assert_eq!;
assert_eq!;
# Ok::
Rollback path:
use ;
let mut db = open_in_memory;
let failed = db.;
assert!;
assert_eq!;
# Ok::
Crash Safety
Transactions are written as BatchBegin ... BatchEnd records.
If a crash occurs before BatchEnd, the entire batch is discarded during
replay. If a crash occurs after BatchEnd, the entire batch is applied.
Features
ttl(default): per-record expiration and default TTL support.nested: dotted-prefix group operations andFocushandles.- persistence (core): append-only file log, replay-on-open, flush policy, and compaction.
- transactions (core): closure-based atomic batches with read-your-writes and crash-safe replay.
TTL Example
#
#
# Ok::
Nested Example
#
#
# Ok::
Goals
- Embedded-first — runs in-process; no separate server, no network.
- High performance — zero-copy reads, allocation-free hot paths, cache-friendly layout.
- Safe — strict
clippyprofile, nounwrapin library code, allunsafedocumented. - Small footprint — minimal dependency graph, fast compile times.
- Portable — Linux, macOS, Windows (x86_64 and ARM64).
Non-Goals
- Client-server operation (use a dedicated DBMS for that).
- A full SQL dialect at this stage.
- Distributed replication at this stage.
Related Projects
emdb is the Rust implementation. Implementations in other languages (Go, C, and others) are planned and will live under their own repositories.
License
Licensed under the Apache License, Version 2.0.
Copyright © 2026 James Gober.