Skip to main content

CompactionOptions

Struct CompactionOptions 

Source
pub struct CompactionOptions { /* private fields */ }
Expand description

Options for a CompactFiles call, which compacts an explicit list of input files.

These are RocksDB’s CompactionOptions from include/rocksdb/options.h, not the CompactRangeOptions behind CompactOptions.

Implementations§

Source§

impl CompactionOptions

Source

pub fn set_compression(&mut self, t: DBCompressionType)

Sets the compression used for the compaction output.

Deprecated upstream, because the CompressionOptions still come from the column family options and so the algorithm picked here can end up paired with tuning meant for a different one. Unset by default. Self::unset_compression puts it back.

Source

pub fn unset_compression(&mut self)

Restores the default, letting RocksDB choose the output compression from the column family options.

RocksDB takes the output level into account, so level specific settings still apply.

Source

pub fn get_compression(&self) -> Option<DBCompressionType>

The compression set for the compaction output, or None when RocksDB will pick it from the column family options.

None also covers a compression type this crate does not name, currently only xpress, which is Windows only.

Source

pub fn set_output_file_size_limit(&mut self, v: u64)

Caps the size of each file the compaction creates.

Defaults to u64::MAX, which means the compaction writes a single output file.

Source

pub fn get_output_file_size_limit(&self) -> u64

The current output file size limit.

Source

pub fn set_max_subcompactions(&mut self, v: u32)

Overrides DBOptions::max_subcompactions for this compaction when greater than 0.

Defaults to 0, meaning the DB level setting wins.

Source

pub fn get_max_subcompactions(&self) -> u32

The current subcompaction override, 0 when the DB level setting is in effect.

Source

pub fn set_allow_trivial_move(&mut self, v: bool)

Lets the compaction move non overlapping input files to the output level instead of rewriting them.

Defaults to false.

Source

pub fn get_allow_trivial_move(&self) -> bool

Whether trivial moves are allowed for this compaction.

Source

pub fn set_output_temperature_override(&mut self, v: Temperature)

Writes the output files with this file temperature.

Leaving it at the default Temperature::Unknown means no override: the output falls back to last_level_temperature when the output level is the last level and to default_write_temperature otherwise.

Source

pub fn get_output_temperature_override(&self) -> Temperature

The output temperature override, Temperature::Unknown when nothing is overridden.

Source

pub fn set_canceled(&mut self, token: Arc<CompactionCancellationToken>)

Attaches a cancellation token so another thread can abort this compaction.

The C side stores the token as a borrowed std::atomic<bool>* inside the options struct, so the flag has to outlive both these options and the CompactFiles call that reads them. Holding an Arc clone enforces that at runtime and keeps CompactionOptions free of a lifetime parameter, which would otherwise spread to every signature that passes the options around. Sharing the token is also the normal case, since something on another thread has to own a handle in order to cancel, and that already wants an Arc.

Source

pub fn clear_canceled(&mut self)

Detaches the cancellation token, if any, and releases this object’s share of it.

Source

pub fn canceled(&self) -> Option<&Arc<CompactionCancellationToken>>

The cancellation token attached by Self::set_canceled, if there is one.

Handed back as the Arc so you can clone another handle out of it.

Trait Implementations§

Source§

impl Default for CompactionOptions

Source§

fn default() -> Self

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

impl Drop for CompactionOptions

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for CompactionOptions

Source§

impl Sync for CompactionOptions

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.