pub struct DBBuilder { /* private fields */ }
Expand description
Struct to construct database
§Example
use nut::DBBuilder;
let db = DBBuilder::new("./test.db").read_only(true).build();
Implementations§
Source§impl DBBuilder
impl DBBuilder
Sourcepub fn no_grow_sync(self, v: bool) -> Self
pub fn no_grow_sync(self, v: bool) -> Self
Sets the DB.no_grow_sync flag before memory mapping the file.
Default: false
Sourcepub fn read_only(self, v: bool) -> Self
pub fn read_only(self, v: bool) -> Self
Open database in read-only mode.
If database opened in read only mode file will be locked shared and exclusively otherwise.
Default: false
Sourcepub fn initial_mmap_size(self, v: usize) -> Self
pub fn initial_mmap_size(self, v: usize) -> Self
Initial mmap size of the database
in bytes. Read transactions won’t block write transaction
if the initial_mmap_size is large enough to hold database mmap size. (See DB.begin for more information)
If = 0, the initial map size is size of first 4 pages.
If initial_mmap_size is smaller than the previous database size, it takes no effect.
Default: 0 (mmap will be equal to 4 page sizes)
Sourcepub fn autoremove(self, v: bool) -> Self
pub fn autoremove(self, v: bool) -> Self
Defines whether db file will be removed after db close
Default: false
Sourcepub fn checkmode(self, v: CheckMode) -> Self
pub fn checkmode(self, v: CheckMode) -> Self
Defines database checking mode
Default: CheckMode::No
Sourcepub fn batch_delay(self, v: Duration) -> Self
pub fn batch_delay(self, v: Duration) -> Self
Defines batch delay time
Default: 10 seconds
Sourcepub fn batch_size(self, v: usize) -> Self
pub fn batch_size(self, v: usize) -> Self
Defines max batch size. If size equals 0, size is unlimited
Default: 1000
Auto Trait Implementations§
impl Freeze for DBBuilder
impl RefUnwindSafe for DBBuilder
impl Send for DBBuilder
impl Sync for DBBuilder
impl Unpin for DBBuilder
impl UnwindSafe for DBBuilder
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
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> ⓘ
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> ⓘ
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