pub struct Config { /* private fields */ }Expand description
Bf-tree configuration for advanced usage. Bf-tree is designed to work well on various workloads that you don’t have to change the default configuration. This configuration is more for advanced users who want to understand the different components of the system, rather than performance tuning.
Implementations§
Source§impl Config
impl Config
pub fn new(file_path: impl AsRef<Path>, circular_buffer_size: usize) -> Config
Sourcepub fn new_with_config_file<P>(config_file_path: P) -> Config
pub fn new_with_config_file<P>(config_file_path: P) -> Config
Constructor of Config based on a config TOML file The config file must have all fields defined ConfigFile
Sourcepub fn storage_backend(&mut self, backend: StorageBackend) -> &mut Config
pub fn storage_backend(&mut self, backend: StorageBackend) -> &mut Config
Default: Std
Use std::fs::file to store/access disk data. For better performance, consider platform specific backends like: IoUringBlocking.
pub fn write_load_full_page(&mut self, load_full_page: bool) -> &mut Config
Sourcepub fn scan_promotion_rate(&mut self, prob: usize) -> &mut Config
pub fn scan_promotion_rate(&mut self, prob: usize) -> &mut Config
Default: 30
prob% of chance that a page will be promoted to buffer during scan operations.
pub fn max_fence_len(&mut self, len: usize) -> &mut Config
Sourcepub fn read_record_cache(&mut self, read_full_page_cache: bool) -> &mut Config
pub fn read_record_cache(&mut self, read_full_page_cache: bool) -> &mut Config
Default: true
By default bf-tree will cache the hot records in mini page. Setting this to false will try to cache the entire base page, which is less efficient.
Sourcepub fn max_mini_page_size(&mut self, size: usize) -> &mut Config
pub fn max_mini_page_size(&mut self, size: usize) -> &mut Config
Default: 2048
The maximum mini page size before it grows to a full page.
Sourcepub fn mini_page_binary_search(&mut self, binary_search: bool) -> &mut Config
pub fn mini_page_binary_search(&mut self, binary_search: bool) -> &mut Config
Default: true
If set to false, the mini page will use linear search instead of binary search.
Sourcepub fn read_promotion_rate(&mut self, prob: usize) -> &mut Config
pub fn read_promotion_rate(&mut self, prob: usize) -> &mut Config
Default: 30
prob% of chance that a record will be promoted from leaf page to mini page.
Sourcepub fn cb_copy_on_access_ratio(&mut self, ratio: f64) -> &mut Config
pub fn cb_copy_on_access_ratio(&mut self, ratio: f64) -> &mut Config
Default: 0.1
The ratio of copy-on-access region for circular buffer.
- 0.0 means the circular buffer is a FIFO.
- 1.0 means the circular buffer is a LRU.
You don’t want to change this unless you know what you are doing.
Sourcepub fn enable_write_ahead_log(
&mut self,
wal_config: Arc<WalConfig>,
) -> &mut Config
pub fn enable_write_ahead_log( &mut self, wal_config: Arc<WalConfig>, ) -> &mut Config
Default: false
Whether to enable write ahead log, for persistency and recovery.
Sourcepub fn enable_write_ahead_log_default(&mut self) -> &mut Config
pub fn enable_write_ahead_log_default(&mut self) -> &mut Config
Default: false
Similar to enable_write_ahead_log, but with default WAL configuration.
The path to write the write ahead log.
Advanced users may want to change the WAL to point to a different location
to leverage different storage patterns
(WAL is always sequence write and requires durability).
Sourcepub fn cache_only(&mut self, cache_only: bool) -> &mut Config
pub fn cache_only(&mut self, cache_only: bool) -> &mut Config
Default: false
Sourcepub fn cb_size_byte(&mut self, cb_size_byte: usize) -> &mut Config
pub fn cb_size_byte(&mut self, cb_size_byte: usize) -> &mut Config
Default: 32 * 1024 * 1024
pub fn file_path<P>(&mut self, file_path: P) -> &mut Config
Sourcepub fn use_snapshot(&mut self, use_snapshot: bool) -> &mut Config
pub fn use_snapshot(&mut self, use_snapshot: bool) -> &mut Config
Default: false
Sourcepub fn snapshot_version(&mut self, snapshot_version: u64) -> &mut Config
pub fn snapshot_version(&mut self, snapshot_version: u64) -> &mut Config
Default: 0
pub fn cb_max_key_len(&mut self, max_key_len: usize) -> &mut Config
pub fn cb_min_record_size(&mut self, min_record_size: usize) -> &mut Config
pub fn cb_max_record_size(&mut self, max_record_size: usize) -> &mut Config
Sourcepub fn get_cb_max_record_size(&self) -> usize
pub fn get_cb_max_record_size(&self) -> usize
Returns the current max record size
pub fn get_cb_size_byte(&self) -> usize
pub fn leaf_page_size(&mut self, leaf_page_size: usize) -> &mut Config
Sourcepub fn get_leaf_page_size(&self) -> usize
pub fn get_leaf_page_size(&self) -> usize
Returns the current leaf page size
Sourcepub fn is_memory_backend(&self) -> bool
pub fn is_memory_backend(&self) -> bool
Returns true if the storage backend is in-memory (no file-backed storage).
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate the configuration and report any invalid parameter, if found.
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 UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
impl<T> AsyncFriendly for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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