Struct pagecache::ConfigBuilder
source · pub struct ConfigBuilder { /* private fields */ }
Expand description
Top-level configuration for the system.
Examples
let _config = pagecache::ConfigBuilder::default()
.path("/path/to/data".to_owned())
.cache_capacity(10_000_000_000)
.use_compression(true)
.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);
Implementations
sourceimpl ConfigBuilder
impl ConfigBuilder
sourcepub fn new() -> ConfigBuilder
pub fn new() -> ConfigBuilder
Returns a default ConfigBuilder
sourcepub fn path<P: AsRef<Path>>(self, path: P) -> ConfigBuilder
pub fn path<P: AsRef<Path>>(self, path: P) -> ConfigBuilder
Set the path of the database (builder).
sourcepub fn merge_operator(self, mo: MergeOperator) -> ConfigBuilder
pub fn merge_operator(self, mo: MergeOperator) -> ConfigBuilder
Set the merge operator that can be relied on during merges in
the PageCache
.
sourcepub fn build(self) -> Config
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.
sourcepub fn io_bufs(self, to: usize) -> ConfigBuilder
pub fn io_bufs(self, to: usize) -> ConfigBuilder
number of io buffers
sourcepub fn io_buf_size(self, to: usize) -> ConfigBuilder
pub fn io_buf_size(self, to: usize) -> ConfigBuilder
size of each io flush buffer. MUST be multiple of 512!
sourcepub fn blink_node_split_size(self, to: usize) -> ConfigBuilder
pub fn blink_node_split_size(self, to: usize) -> ConfigBuilder
b-link tree node size in bytes before splitting
sourcepub fn page_consolidation_threshold(self, to: usize) -> ConfigBuilder
pub fn page_consolidation_threshold(self, to: usize) -> ConfigBuilder
page consolidation threshold
sourcepub fn temporary(self, to: bool) -> ConfigBuilder
pub fn temporary(self, to: bool) -> ConfigBuilder
deletes the database after drop. if no path is set, uses /dev/shm on linux
sourcepub fn read_only(self, to: bool) -> ConfigBuilder
pub fn read_only(self, to: bool) -> ConfigBuilder
whether to run in read-only mode
sourcepub fn cache_bits(self, to: usize) -> ConfigBuilder
pub fn cache_bits(self, to: usize) -> ConfigBuilder
log base 2 of the number of cache shards
sourcepub fn cache_capacity(self, to: usize) -> ConfigBuilder
pub fn cache_capacity(self, to: usize) -> ConfigBuilder
maximum size for the system page cache
sourcepub fn use_compression(self, to: bool) -> ConfigBuilder
pub fn use_compression(self, to: bool) -> ConfigBuilder
whether to use zstd compression
sourcepub fn compression_factor(self, to: i32) -> ConfigBuilder
pub fn compression_factor(self, to: i32) -> ConfigBuilder
the compression factor to use with zstd compression
sourcepub fn flush_every_ms(self, to: Option<u64>) -> ConfigBuilder
pub fn flush_every_ms(self, to: Option<u64>) -> ConfigBuilder
number of ms between IO buffer flushes
sourcepub fn snapshot_after_ops(self, to: usize) -> ConfigBuilder
pub fn snapshot_after_ops(self, to: usize) -> ConfigBuilder
number of operations between page table snapshots
sourcepub fn segment_cleanup_threshold(self, to: f64) -> ConfigBuilder
pub fn segment_cleanup_threshold(self, to: f64) -> ConfigBuilder
the proportion of remaining valid pages in the segment
sourcepub fn segment_cleanup_skew(self, to: usize) -> ConfigBuilder
pub fn segment_cleanup_skew(self, to: usize) -> ConfigBuilder
the cleanup threshold skew in percentage points between the first and last segments
sourcepub fn segment_mode(self, to: SegmentMode) -> ConfigBuilder
pub fn segment_mode(self, to: SegmentMode) -> ConfigBuilder
the file segment selection mode
sourcepub fn snapshot_path(self, to: Option<PathBuf>) -> ConfigBuilder
pub fn snapshot_path(self, to: Option<PathBuf>) -> ConfigBuilder
snapshot file location
sourcepub fn print_profile_on_drop(self, to: bool) -> ConfigBuilder
pub fn print_profile_on_drop(self, to: bool) -> ConfigBuilder
print a performance profile when the Config is dropped
sourcepub fn idgen_persist_interval(self, to: usize) -> ConfigBuilder
pub fn idgen_persist_interval(self, to: usize) -> ConfigBuilder
generated IDs are persisted at this interval. during recovery we skip twice this number
sourcepub fn async_io(self, to: bool) -> ConfigBuilder
pub fn async_io(self, to: bool) -> ConfigBuilder
perform IO operations on a threadpool
sourcepub fn async_io_threads(self, to: usize) -> ConfigBuilder
pub fn async_io_threads(self, to: usize) -> ConfigBuilder
set the number of threads in the IO threadpool. defaults to # logical CPUs.
Trait Implementations
sourceimpl Clone for ConfigBuilder
impl Clone for ConfigBuilder
sourcefn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more