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) -> Self
Sourcepub fn new_with_config_file<P: AsRef<Path>>(config_file_path: P) -> Self
pub fn new_with_config_file<P: AsRef<Path>>(config_file_path: P) -> Self
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 Self
pub fn storage_backend(&mut self, backend: StorageBackend) -> &mut Self
Default: Std
Use std::fs::file to store/access disk data. For better performance, consider platform specific backends like: IoUringBlocking.
Sourcepub fn scan_promotion_rate(&mut self, prob: usize) -> &mut Self
pub fn scan_promotion_rate(&mut self, prob: usize) -> &mut Self
Default: 30
prob% of chance that a page will be promoted to buffer during scan operations.
Sourcepub fn read_record_cache(&mut self, read_full_page_cache: bool) -> &mut Self
pub fn read_record_cache(&mut self, read_full_page_cache: bool) -> &mut Self
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 Self
pub fn max_mini_page_size(&mut self, size: usize) -> &mut Self
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 Self
pub fn mini_page_binary_search(&mut self, binary_search: bool) -> &mut Self
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 Self
pub fn read_promotion_rate(&mut self, prob: usize) -> &mut Self
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 Self
pub fn cb_copy_on_access_ratio(&mut self, ratio: f64) -> &mut Self
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 Self
pub fn enable_write_ahead_log( &mut self, wal_config: Arc<WalConfig>, ) -> &mut Self
Default: false
Whether to enable write ahead log, for persistency and recovery.
Sourcepub fn enable_write_ahead_log_default(&mut self) -> &mut Self
pub fn enable_write_ahead_log_default(&mut self) -> &mut Self
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 Self
pub fn cache_only(&mut self, cache_only: bool) -> &mut Self
Default: false
Sourcepub fn cb_size_byte(&mut self, cb_size_byte: usize) -> &mut Self
pub fn cb_size_byte(&mut self, cb_size_byte: usize) -> &mut Self
Default: 32 * 1024 * 1024
pub fn file_path<P: AsRef<Path>>(&mut self, file_path: P) -> &mut Self
pub fn cb_max_key_len(&mut self, max_key_len: usize) -> &mut Self
pub fn cb_min_record_size(&mut self, min_record_size: usize) -> &mut Self
pub fn cb_max_record_size(&mut self, max_record_size: usize) -> &mut Self
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 Self
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.