pub struct RedbBackend { /* private fields */ }Expand description
redb-backed StorageBackend.
One redb::Database file per backend instance. All keys share a single
"graphrefly" table. Per-write-call ACID transactions (D163).
§Example
ⓘ
use std::sync::Arc;
use graphrefly_storage::{redb_backend, snapshot_storage, SnapshotStorageOptions};
let backend = redb_backend("./checkpoints.redb");
let tier = snapshot_storage(backend, SnapshotStorageOptions::<MyState, _>::default());
tier.save(state).unwrap();Implementations§
Source§impl RedbBackend
impl RedbBackend
Trait Implementations§
Source§impl Debug for RedbBackend
impl Debug for RedbBackend
Source§impl StorageBackend for RedbBackend
impl StorageBackend for RedbBackend
Source§fn name(&self) -> &str
fn name(&self) -> &str
Diagnostic name (e.g.
"memory", "file:./checkpoints"). Surfaces
in error messages and tier Display impls.Source§fn read(&self, key: &str) -> Result<Option<Vec<u8>>, StorageError>
fn read(&self, key: &str) -> Result<Option<Vec<u8>>, StorageError>
Read raw bytes; returns
Ok(None) on miss.Source§fn delete(&self, key: &str) -> Result<(), StorageError>
fn delete(&self, key: &str) -> Result<(), StorageError>
Optional delete-by-key. Default is no-op so append-only or read-only
backends can stay quiet.
Source§fn list(&self, prefix: &str) -> Result<Vec<String>, StorageError>
fn list(&self, prefix: &str) -> Result<Vec<String>, StorageError>
Enumerate keys matching
prefix (lex-ASC). Empty prefix enumerates
all keys. Default returns BackendNoListSupport — backends that don’t
support enumeration surface the diagnostic here at first call, NOT at
attach (mirrors TS lazy-throw semantics for list_by_prefix).Auto Trait Implementations§
impl Freeze for RedbBackend
impl !RefUnwindSafe for RedbBackend
impl Send for RedbBackend
impl Sync for RedbBackend
impl Unpin for RedbBackend
impl UnsafeUnpin for RedbBackend
impl !UnwindSafe for RedbBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more