[]Struct sled_extensions::ConfigBuilder

pub struct ConfigBuilder { /* fields omitted */ }

Top-level configuration for the system.

Examples

let _config = pagecache::ConfigBuilder::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 = pagecache::ConfigBuilder::default()
    .path("/path/to/data".to_owned())
    .read_only(true);

Methods

impl ConfigBuilder

pub fn new() -> ConfigBuilder

Returns a default ConfigBuilder

pub fn path<P>(self, path: P) -> ConfigBuilder where
    P: AsRef<Path>, 

Set the path of the database (builder).

pub fn build(self) -> Config

Finalize the configuration.

Panics

This function will panic if it is not possible to open the files for performing database IO, or if the provided configuration fails some basic sanity checks.

pub fn io_buf_size(self, to: usize) -> ConfigBuilder

size of each io flush buffer. MUST be multiple of 512!

pub fn page_consolidation_threshold(self, to: usize) -> ConfigBuilder

page consolidation threshold

pub fn temporary(self, to: bool) -> ConfigBuilder

deletes the database after drop. if no path is set, uses /dev/shm on linux

pub fn read_only(self, to: bool) -> ConfigBuilder

whether to run in read-only mode

pub fn cache_capacity(self, to: u64) -> ConfigBuilder

maximum size for the system page cache

pub fn use_compression(self, to: bool) -> ConfigBuilder

whether to use zstd compression

pub fn compression_factor(self, to: i32) -> ConfigBuilder

the compression factor to use with zstd compression

pub fn flush_every_ms(self, to: Option<u64>) -> ConfigBuilder

number of ms between IO buffer flushes

pub fn snapshot_after_ops(self, to: u64) -> ConfigBuilder

number of operations between page table snapshots

pub fn segment_cleanup_threshold(self, to: f64) -> ConfigBuilder

the proportion of remaining valid pages in the segment before GC defragments it

pub fn segment_cleanup_skew(self, to: usize) -> ConfigBuilder

the cleanup threshold skew in percentage points between the first and last segments

pub fn segment_mode(self, to: SegmentMode) -> ConfigBuilder

the file segment selection mode

pub fn snapshot_path(self, to: Option<PathBuf>) -> ConfigBuilder

snapshot file location

pub fn print_profile_on_drop(self, to: bool) -> ConfigBuilder

print a performance profile when the Config is dropped

pub fn idgen_persist_interval(self, to: u64) -> ConfigBuilder

generated IDs are persisted at this interval. during recovery we skip twice this number

Trait Implementations

impl Send for ConfigBuilder

impl<'de> Deserialize<'de> for ConfigBuilder

impl Serialize for ConfigBuilder

impl Clone for ConfigBuilder

impl Debug for ConfigBuilder

impl Default for ConfigBuilder

impl PartialEq<ConfigBuilder> for ConfigBuilder

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]