Struct Config

Source
pub struct Config {
    pub path: PathBuf,
    pub zstd_compression_level: Option<i32>,
    pub fsync_each_batch: bool,
    pub target_file_size: usize,
    pub file_compaction_percent: u8,
    pub max_object_size: usize,
    pub small_file_cleanup_threshold: usize,
    pub partition_function: fn(object_id: u64, object_size: usize) -> u8,
    pub min_compaction_files: usize,
}
Expand description

Configuration for configuring Marble.

Fields§

§path: PathBuf

Storage files will be kept here.

§zstd_compression_level: Option<i32>

The compression level to use when compressing each batch of objects. A value of None disables compression. This is one of the most important parameters to experiment with while finding an appropriate configuration for your system.

§fsync_each_batch: bool

Issue fsyncs on each new file and the containing directory when it is created. This corresponds to at least one call to fsync for each call to write_batch.

§target_file_size: usize

Garbage collection will try to keep storage files around this size or smaller.

§file_compaction_percent: u8

Remaining live percentage of a file before it’s considered rewritabe.

§max_object_size: usize

The ceiling on the largest allocation this system will ever attempt to perform in order to read an object off of disk.

§small_file_cleanup_threshold: usize

The number of total files (of all sizes) that must exist before “small files” are squished together even if they are above the file_compaction_percent. A “small file” is defined as a file whose uncompressed size times min_compaction_files is below the target_file_size.

§partition_function: fn(object_id: u64, object_size: usize) -> u8

A partitioning function for objects based on object ID and object size. You may override this to cause objects to be written into separate files so that garbage collection may take advantage of locality effects for your workload that are correlated to object identifiers or the size of data.

Ideally, you will colocate objects that have similar expected lifespans. Doing so minimizes the costs of copying live data over time during storage file GC.

§min_compaction_files: usize

The minimum number of files within a generation to collect if below the live compaction percent.

Implementations§

Source§

impl Config

Source

pub fn open(&self) -> Result<Marble>

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Config

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.