pub struct RedbBackend { /* private fields */ }Expand description
Redb-based storage backend (default).
Implementations§
Source§impl RedbBackend
impl RedbBackend
Trait Implementations§
Source§impl StorageBackend for RedbBackend
impl StorageBackend for RedbBackend
Source§fn get(&self, table: &str, key: &[u8]) -> Result<Option<Vec<u8>>>
fn get(&self, table: &str, key: &[u8]) -> Result<Option<Vec<u8>>>
Get a value by key from the specified table.
Source§fn put(&self, table: &str, key: &[u8], value: &[u8]) -> Result<()>
fn put(&self, table: &str, key: &[u8], value: &[u8]) -> Result<()>
Store a key-value pair in the specified table.
Source§fn delete(&self, table: &str, key: &[u8]) -> Result<bool>
fn delete(&self, table: &str, key: &[u8]) -> Result<bool>
Delete a key from the specified table. Returns true if the key existed.
Source§fn list(&self, table: &str) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
fn list(&self, table: &str) -> Result<Vec<(Vec<u8>, Vec<u8>)>>
List all key-value pairs in the specified table.
Source§fn put_batch(&self, table: &str, entries: &[(&[u8], &[u8])]) -> Result<()>
fn put_batch(&self, table: &str, entries: &[(&[u8], &[u8])]) -> Result<()>
Store multiple key-value pairs in a single atomic operation.
Source§fn delete_batch(&self, table: &str, keys: &[&[u8]]) -> Result<()>
fn delete_batch(&self, table: &str, keys: &[&[u8]]) -> Result<()>
Delete multiple keys from the specified table in a single atomic
operation. The default implementation calls
delete per key and is
not atomic; backends with transaction support should override this.Source§fn write_atomic(&self, ops: &[AtomicOp<'_>]) -> Result<()>
fn write_atomic(&self, ops: &[AtomicOp<'_>]) -> Result<()>
Apply several put/delete operations across tables. The default implementation applies each op
sequentially via
put/delete and is NOT atomic; backends with transaction support should
override this so a crash mid-batch cannot leave the ops half-applied. Each op must target a
DISTINCT table.Source§fn list_keys_with_prefix(
&self,
table: &str,
prefix: &[u8],
) -> Result<Vec<Vec<u8>>>
fn list_keys_with_prefix( &self, table: &str, prefix: &[u8], ) -> Result<Vec<Vec<u8>>>
List only the keys (no values) in the specified table whose bytes
start with
prefix. The default implementation falls back to a full
scan and is suitable for backends without a native prefix iterator.Source§fn run_migrations(&self) -> Result<MigrationResult>
fn run_migrations(&self) -> Result<MigrationResult>
Run pending migrations. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for RedbBackend
impl !UnwindSafe for RedbBackend
impl Forget for RedbBackend
impl Freeze for RedbBackend
impl Move for RedbBackend
impl Send for RedbBackend
impl Sync for RedbBackend
impl Unpin for RedbBackend
impl UnsafeUnpin 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