Struct 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§

Source§

impl ConfigBuilder

Source

pub fn new() -> ConfigBuilder

Returns a default ConfigBuilder

Source

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

Set the path of the database (builder).

Source

pub fn set_path<P>(&mut self, path: P)
where P: AsRef<Path>,

Set the path of the database

Source

pub fn build(self) -> Config

Finalize the configuration.

Source

pub fn set_io_bufs(&mut self, to: usize)

number of io buffers

Source

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

number of io buffers

Source

pub fn set_io_buf_size(&mut self, to: usize)

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

Source

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

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

Source

pub fn set_min_items_per_segment(&mut self, to: usize)

minimum data chunks/pages in a segment.

Source

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

minimum data chunks/pages in a segment.

b-link node fanout, minimum of 2

b-link node fanout, minimum of 2

Source

pub fn set_page_consolidation_threshold(&mut self, to: usize)

page consolidation threshold

Source

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

page consolidation threshold

Source

pub fn set_temporary(&mut self, to: bool)

if this database should be removed after the ConfigBuilder is dropped

Source

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

if this database should be removed after the ConfigBuilder is dropped

Source

pub fn set_read_only(&mut self, to: bool)

whether to run in read-only mode

Source

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

whether to run in read-only mode

Source

pub fn set_cache_bits(&mut self, to: usize)

log base 2 of the number of cache shards

Source

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

log base 2 of the number of cache shards

Source

pub fn set_cache_capacity(&mut self, to: usize)

maximum size for the system page cache

Source

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

maximum size for the system page cache

Source

pub fn set_use_os_cache(&mut self, to: bool)

whether to use the OS page cache

Source

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

whether to use the OS page cache

Source

pub fn set_use_compression(&mut self, to: bool)

whether to use zstd compression

Source

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

whether to use zstd compression

Source

pub fn set_zstd_compression_factor(&mut self, to: i32)

the compression factor to use with zstd compression

Source

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

the compression factor to use with zstd compression

Source

pub fn set_flush_every_ms(&mut self, to: Option<u64>)

number of ms between IO buffer flushes

Source

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

number of ms between IO buffer flushes

Source

pub fn set_snapshot_after_ops(&mut self, to: usize)

number of operations between page table snapshots

Source

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

number of operations between page table snapshots

Source

pub fn set_cache_fixup_threshold(&mut self, to: usize)

the maximum length of a cached page fragment chain

Source

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

the maximum length of a cached page fragment chain

Source

pub fn set_segment_cleanup_threshold(&mut self, to: f64)

the proportion of remaining valid pages in the segment

Source

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

the proportion of remaining valid pages in the segment

Source

pub fn set_min_free_segments(&mut self, to: usize)

the minimum number of free segments to have on-deck before a compaction occurs

Source

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

the minimum number of free segments to have on-deck before a compaction occurs

Source

pub fn set_zero_copy_storage(&mut self, to: bool)

disabling of the log segment copy cleaner

Source

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

disabling of the log segment copy cleaner

Source

pub fn set_segment_mode(&mut self, to: SegmentMode)

the file segment selection mode

Source

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

the file segment selection mode

Source

pub fn set_snapshot_path(&mut self, to: Option<OsString>)

snapshot file location

Source

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

snapshot file location

Trait Implementations§

Source§

impl Clone for ConfigBuilder

Source§

fn clone(&self) -> ConfigBuilder

Returns a copy 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 ConfigBuilder

Source§

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

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

impl Default for ConfigBuilder

Source§

fn default() -> ConfigBuilder

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

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

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ConfigBuilder, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ConfigBuilder

Source§

fn eq(&self, other: &ConfigBuilder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ConfigBuilder

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Send for ConfigBuilder

Source§

impl StructuralPartialEq for ConfigBuilder

Auto Trait Implementations§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,