Skip to main content

Crate drasi_state_store_redb

Crate drasi_state_store_redb 

Source
Expand description

Redb-Based State Store Provider for Drasi

This crate provides a persistent state store provider using redb, an embedded key-value database written in pure Rust.

§Features

  • ACID Transactions: All operations are atomic and durable
  • Persistent Storage: Data survives restarts
  • Partitioned by Store ID: Each plugin gets its own table
  • Thread-Safe: Safe for concurrent access from multiple plugins
  • No External Dependencies: Pure Rust implementation

§Usage

use drasi_state_store_redb::RedbStateStoreProvider;
use drasi_lib::DrasiLib;
use std::sync::Arc;

let state_store = RedbStateStoreProvider::new("/data/state.redb")?;
let drasi = DrasiLib::builder()
    .with_state_store_provider(Arc::new(state_store))
    .build()
    .await?;

§Database Structure

The provider creates a single redb database file with a separate table for each store_id. Tables are created dynamically when first accessed and remain in the database for subsequent operations.

Keys and values are stored as byte arrays (&[u8] / Vec<u8>).

Structs§

RedbStateStoreProvider
Redb-based state store provider.