Crate async_rocksdb

Crate async_rocksdb 

Source
Expand description

§async-rocksdb

An ergonomic, async wrapper for RocksDB in Rust.

Provides non-blocking operations suitable for Tokio-based applications.

§Important Note on Column Families

When you use AsyncRocksBuilder::add_column_family, the database is opened in “explicit column family mode”. In this mode, the default column family is not created automatically.

If you want to use cf: None (which maps to “default”), you must explicitly add it:

use async_rocksdb::AsyncRocksBuilder;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let path = "/tmp/async-rocksdb-doctest-cf";
    let _ = std::fs::remove_dir_all(path); // cleanup

    let db = AsyncRocksBuilder::new()
        .add_column_family("default")  // required for cf: None
        .add_column_family("users")
        .open(path)
        .await?;

    db.put(b"key", b"value", None).await?;  // works
    Ok(())
}

If you don’t add any column families, the default one is created automatically and cf: None works.

§Features

  • Async reads/writes
  • Column families
  • Snapshots
  • Prefix scans
  • Batch operations
  • Manual flush/compaction

Structs§

AsyncRocksBuilder
Builder for configuring and opening an AsyncRocksDB instance.
AsyncRocksDB
Async RocksDB wrapper.
ColumnFamilyConfig
Configuration for a single column family.
Snapshot
A point-in-time snapshot of the database.

Enums§

AsyncRocksError
Error type for async-rocksdb operations.