pub struct RedbBackend { /* private fields */ }Expand description
Redb backend implementation for persistent key-value storage.
This backend uses redb’s ACID transactions to ensure data consistency. All operations are atomic and durable by default.
§Thread Safety
The Arc<Database> wrapper allows safe sharing across threads.
Redb handles its own internal locking and MVCC.
Implementations§
Source§impl RedbBackend
impl RedbBackend
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self, IndexError>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, IndexError>
Open or create a Redb database at the given path.
§Arguments
path- The file path where the database will be stored
§Returns
Ok(RedbBackend)- Successfully opened or created databaseErr(IndexError)- Failed to open/create database
§Example
use index::RedbBackend;
let backend = RedbBackend::open("/tmp/test.redb").unwrap();Trait Implementations§
Source§impl IndexBackend for RedbBackend
impl IndexBackend for RedbBackend
Source§fn put(&self, key: &str, value: &[u8]) -> Result<(), IndexError>
fn put(&self, key: &str, value: &[u8]) -> Result<(), IndexError>
Insert or update a key-value pair.
Source§fn batch_put(&self, entries: Vec<(String, Vec<u8>)>) -> Result<(), IndexError>
fn batch_put(&self, entries: Vec<(String, Vec<u8>)>) -> Result<(), IndexError>
Insert or update multiple key-value pairs in a batch.
Auto Trait Implementations§
impl Freeze for RedbBackend
impl !RefUnwindSafe for RedbBackend
impl Send for RedbBackend
impl Sync for RedbBackend
impl Unpin 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more