| Crates.io | async-rocksdb |
| lib.rs | async-rocksdb |
| version | 0.1.1 |
| created_at | 2026-01-04 15:35:07.408957+00 |
| updated_at | 2026-01-04 16:50:06.357424+00 |
| description | Async-aware wrapper for RocksDB |
| homepage | |
| repository | https://github.com/olatunbosunoyeleke94/async-rocksdb |
| max_upload_size | |
| id | 2022063 |
| size | 39,074 |
An ergonomic, async wrapper for RocksDB in Rust.
multi_get, multi_delete)use async_rocksdb::AsyncRocksBuilder;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let db = AsyncRocksBuilder::new()
.open("/tmp/mydb")
.await?;
db.put(b"key", b"value", None).await?;
let val = db.get(b"key", None, None).await?;
println!("{:?}", val);
Ok(())
}
## Column Families
```rust
let db = AsyncRocksBuilder::new()
.add_column_family("users")
.add_column_family("logs")
.open("/tmp/mydb")
.await?;
db.put(b"user:alice", b"data", Some("users")).await?;
let val = db.get(b"user:alice", Some("users"), None).await?;
## Snapshots
Snapshots are best-effort consistent in async context due to spawn_blocking scheduling.
```rust
let snapshot = db.snapshot();
db.put(b"key", b"new", None).await?;
// Latest read sees "new"
assert_eq!(db.get(b"key", None, None).await?, Some(b"new".to_vec()));
// Snapshot read sees old value (or latest in async context)
let old = db.get(b"key", None, Some(snapshot)).await?;
## Prefix Scans
```rust
db.put(b"user:alice", b"...", None).await?;
db.put(b"user:bob", b"...", None).await?;
db.put(b"order:123", b"...", None).await?;
let users = db.prefix_all(b"user:", None, None).await?;
assert_eq!(users.len(), 2);
## Batch Operations
```rust
let keys = vec![b"key1", b"key2"];
let values = db.multi_get(keys, None, None).await?;
let _ = db.multi_delete(vec![b"key1", b"key2"], None).await?;
## Why async-rocksdb?
The official crate for rocksdb is perfect but sync only.
In async apps, calls are wrapped in spawn_blocking.
And this crate does that with a clean API AND extra features like prefix scans and snapshots.