Crate crepedb

Crate crepedb 

Source
Expand description

§CrepeDB

A versioned and forkable embedded database library.

CrepeDB provides a multi-version concurrency control (MVCC) database with snapshot isolation. It supports forking database snapshots and maintains version history efficiently.

§Features

  • Versioned Storage: Track changes across multiple versions
  • Snapshot Isolation: Create and read from consistent snapshots
  • Fork Support: Create new branches from any snapshot
  • Backend Abstraction: Use different storage backends (e.g., redb, rocksdb, mdbx)

§Example

use crepedb::{CrepeDB, SnapshotId};
use crepedb::backend::RedbDatabase;

// Create a database with a backend
let backend = RedbDatabase::memory()?;
let db = CrepeDB::new(backend);

// Create root snapshot
let wtxn = db.write(None)?;
wtxn.create_versioned_table("my_table")?;
let root = wtxn.commit()?;

// Write data
let wtxn = db.write(Some(root))?;
let mut table = wtxn.open_table("my_table")?;
table.set(b"key".to_vec(), b"value".to_vec())?;
let snapshot1 = wtxn.commit()?;

// Read data
let rtxn = db.read(Some(snapshot1))?;
let table = rtxn.open_table("my_table")?;
let value = table.get(b"key".to_vec())?;

Modules§

backend
Storage backend implementations.
types
Core types used throughout CrepeDB.

Structs§

CrepeDB
Versioned and forkable Database
ReadTable
A read-only view of a table at a specific snapshot.
ReadTxn
A read transaction for querying data at a specific snapshot.
SnapshotInfo
Information about a database snapshot.
WriteTable
A writable view of a table within a write transaction.
WriteTxn
A write transaction for modifying data and creating new snapshots.

Enums§

Error
Errors that can occur during CrepeDB operations.

Type Aliases§

Result
Result type alias for CrepeDB operations.