Struct rocksdb::UniversalCompactOptions

source ·
pub struct UniversalCompactOptions { /* private fields */ }

Implementations§

source§

impl UniversalCompactOptions

source

pub fn set_size_ratio(&mut self, ratio: c_int)

Sets the percentage flexibility while comparing file size. If the candidate file(s) size is 1% smaller than the next file’s size, then include next file into this candidate set.

Default: 1

source

pub fn set_min_merge_width(&mut self, num: c_int)

Sets the minimum number of files in a single compaction run.

Default: 2

source

pub fn set_max_merge_width(&mut self, num: c_int)

Sets the maximum number of files in a single compaction run.

Default: UINT_MAX

source

pub fn set_max_size_amplification_percent(&mut self, v: c_int)

sets the size amplification.

It is defined as the amount (in percentage) of additional storage needed to store a single byte of data in the database. For example, a size amplification of 2% means that a database that contains 100 bytes of user-data may occupy upto 102 bytes of physical storage. By this definition, a fully compacted database has a size amplification of 0%. Rocksdb uses the following heuristic to calculate size amplification: it assumes that all files excluding the earliest file contribute to the size amplification.

Default: 200, which means that a 100 byte database could require upto 300 bytes of storage.

source

pub fn set_compression_size_percent(&mut self, v: c_int)

Sets the percentage of compression size.

If this option is set to be -1, all the output files will follow compression type specified.

If this option is not negative, we will try to make sure compressed size is just above this value. In normal cases, at least this percentage of data will be compressed. When we are compacting to a new file, here is the criteria whether it needs to be compressed: assuming here are the list of files sorted by generation time: A1…An B1…Bm C1…Ct where A1 is the newest and Ct is the oldest, and we are going to compact B1…Bm, we calculate the total size of all the files as total_size, as well as the total size of C1…Ct as total_C, the compaction output file will be compressed iff total_C / total_size < this percentage

Default: -1

source

pub fn set_stop_style(&mut self, style: UniversalCompactionStopStyle)

Sets the algorithm used to stop picking files into a single compaction run.

Default: ::Total

Trait Implementations§

source§

impl Default for UniversalCompactOptions

source§

fn default() -> Self

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

impl Drop for UniversalCompactOptions

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.