pub struct Builder { /* private fields */ }
Expand description
Configuration builder of a redb Database.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn set_repair_callback(
&mut self,
callback: impl Fn(&mut RepairSession) + 'static,
) -> &mut Self
pub fn set_repair_callback( &mut self, callback: impl Fn(&mut RepairSession) + 'static, ) -> &mut Self
Set a callback which will be invoked periodically in the event that the database file needs to be repaired.
The RepairSession argument can be used to control the repair process.
If the database file needs repair, the callback will be invoked at least once. There is no upper limit on the number of times it may be called.
Sourcepub fn set_cache_size(&mut self, bytes: usize) -> &mut Self
pub fn set_cache_size(&mut self, bytes: usize) -> &mut Self
Set the amount of memory (in bytes) used for caching data
Sourcepub fn create(&self, path: impl AsRef<Path>) -> Result<Database, DatabaseError>
pub fn create(&self, path: impl AsRef<Path>) -> Result<Database, DatabaseError>
Opens the specified file as a redb database.
- if the file does not exist, or is an empty file, a new database will be initialized in it
- if the file is a valid redb database, it will be opened
- otherwise this function will return an error
Sourcepub fn open(&self, path: impl AsRef<Path>) -> Result<Database, DatabaseError>
pub fn open(&self, path: impl AsRef<Path>) -> Result<Database, DatabaseError>
Opens an existing redb database.
Sourcepub fn create_file(&self, file: File) -> Result<Database, DatabaseError>
pub fn create_file(&self, file: File) -> Result<Database, DatabaseError>
Open an existing or create a new database in the given file
.
The file must be empty or contain a valid database.
Sourcepub fn create_with_backend(
&self,
backend: impl StorageBackend,
) -> Result<Database, DatabaseError>
pub fn create_with_backend( &self, backend: impl StorageBackend, ) -> Result<Database, DatabaseError>
Open an existing or create a new database with the given backend.
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl !Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
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