Skip to main content

Config

Struct Config 

Source
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

Source

pub fn new(file_path: impl AsRef<Path>, circular_buffer_size: usize) -> Self

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Default: true

If set to false, the mini page will use linear search instead of binary search.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn cache_only(&mut self, cache_only: bool) -> &mut Self

Default: false

Source

pub fn cb_size_byte(&mut self, cb_size_byte: usize) -> &mut Self

Default: 32 * 1024 * 1024

Source

pub fn file_path<P: AsRef<Path>>(&mut self, file_path: P) -> &mut Self

Source

pub fn cb_max_key_len(&mut self, max_key_len: usize) -> &mut Self

Source

pub fn cb_min_record_size(&mut self, min_record_size: usize) -> &mut Self

Source

pub fn cb_max_record_size(&mut self, max_record_size: usize) -> &mut Self

Source

pub fn get_cb_max_record_size(&self) -> usize

Returns the current max record size

Source

pub fn get_cb_size_byte(&self) -> usize

Source

pub fn leaf_page_size(&mut self, leaf_page_size: usize) -> &mut Self

Source

pub fn get_leaf_page_size(&self) -> usize

Returns the current leaf page size

Source

pub fn validate(&self) -> Result<(), ConfigError>

Validate the configuration and report any invalid parameter, if found.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Default BfTree configuration

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V