pub struct Config(/* private fields */);
Expand description
Top-level configuration for the system.
§Examples
let _config = sled::Config::default()
.path("/path/to/data".to_owned())
.cache_capacity(10_000_000_000)
.flush_every_ms(Some(1000))
.snapshot_after_ops(100_000);
// Read-only mode
let _config = sled::Config::default()
.path("/path/to/data".to_owned())
.read_only(true);
Implementations§
Source§impl Config
impl Config
Sourcepub fn temporary(self, to: bool) -> Config
pub fn temporary(self, to: bool) -> Config
deletes the database after drop. if no path is set, uses /dev/shm on linux
Sourcepub fn cache_capacity(self, to: u64) -> Config
pub fn cache_capacity(self, to: u64) -> Config
maximum size for the system page cache
Sourcepub fn use_compression(self, to: bool) -> Config
pub fn use_compression(self, to: bool) -> Config
whether to use zstd compression
Sourcepub fn compression_factor(self, to: i32) -> Config
pub fn compression_factor(self, to: i32) -> Config
the compression factor to use with zstd compression
Sourcepub fn flush_every_ms(self, to: Option<u64>) -> Config
pub fn flush_every_ms(self, to: Option<u64>) -> Config
number of ms between IO buffer flushes
Sourcepub fn snapshot_after_ops(self, to: u64) -> Config
pub fn snapshot_after_ops(self, to: u64) -> Config
number of operations between page table snapshots
Sourcepub fn segment_cleanup_threshold(self, to: u8) -> Config
pub fn segment_cleanup_threshold(self, to: u8) -> Config
the proportion of remaining valid pages in the segment before GC defragments it
Sourcepub fn segment_cleanup_skew(self, to: usize) -> Config
pub fn segment_cleanup_skew(self, to: usize) -> Config
the cleanup threshold skew in percentage points between the first and last segments
Sourcepub fn segment_mode(self, to: SegmentMode) -> Config
pub fn segment_mode(self, to: SegmentMode) -> Config
the file segment selection mode
Sourcepub fn snapshot_path(self, to: Option<PathBuf>) -> Config
pub fn snapshot_path(self, to: Option<PathBuf>) -> Config
snapshot file location
Sourcepub fn print_profile_on_drop(self, to: bool) -> Config
pub fn print_profile_on_drop(self, to: bool) -> Config
print a performance profile when the Config is dropped
Sourcepub fn idgen_persist_interval(self, to: u64) -> Config
pub fn idgen_persist_interval(self, to: u64) -> Config
generated IDs are persisted at this interval. during recovery we skip twice this number
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
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