redb is a simple,Portable, high-performance, ACID, embedded key-value storage.

redb is written in pure Rust and is supported by lmdb some inspiration.data stored inan mmap’ed,copy-on-write B-trees in the collection.For details, seedesign document.

use redb::{Database, Error, ReadableTable, TableDefinition};

const TABLE: TableDefinition<str, u64> = TableDefinition::new("my_data");

fn main() -> Result<(), Error> {
    let db = unsafe { Database::create("my_db.redb")? };
    let write_txn = db.begin_write()?;
    {
        let mut table = write_txn.open_table(TABLE)?;
        table.insert("my_key", &123)?;
    }
    write_txn.commit()?;

    let read_txn = db.begin_read()?;
    let table = read_txn.open_table(TABLE)?;
    assert_eq!(table.get("my_key")?.unwrap(), 123);

    Ok(())
}

redb is under active development.

characteristic:

  • Zero-copy, thread-safe, based onBTreeMapAPI
  • Fully ACID compliant transactions
  • MVCC supports concurrent readers and writers, non-blocking
  • default Crash-safe
  • Savepoints and rollbacks

Benchmarks:

#redb #homepage #documentation #downloads #Embedded #keyvalue #database #pure #Rust #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *