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
impl CompactionOptions
Sourcepub fn set_compression(&mut self, t: DBCompressionType)
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.
Sourcepub fn unset_compression(&mut self)
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.
Sourcepub fn get_compression(&self) -> Option<DBCompressionType>
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.
Sourcepub fn set_output_file_size_limit(&mut self, v: u64)
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.
Sourcepub fn get_output_file_size_limit(&self) -> u64
pub fn get_output_file_size_limit(&self) -> u64
The current output file size limit.
Sourcepub fn set_max_subcompactions(&mut self, v: u32)
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.
Sourcepub fn get_max_subcompactions(&self) -> u32
pub fn get_max_subcompactions(&self) -> u32
The current subcompaction override, 0 when the DB level setting is in effect.
Sourcepub fn set_allow_trivial_move(&mut self, v: bool)
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.
Sourcepub fn get_allow_trivial_move(&self) -> bool
pub fn get_allow_trivial_move(&self) -> bool
Whether trivial moves are allowed for this compaction.
Sourcepub fn set_output_temperature_override(&mut self, v: Temperature)
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.
Sourcepub fn get_output_temperature_override(&self) -> Temperature
pub fn get_output_temperature_override(&self) -> Temperature
The output temperature override, Temperature::Unknown when nothing is
overridden.
Sourcepub fn set_canceled(&mut self, token: Arc<CompactionCancellationToken>)
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.
Sourcepub fn clear_canceled(&mut self)
pub fn clear_canceled(&mut self)
Detaches the cancellation token, if any, and releases this object’s share of it.
Sourcepub fn canceled(&self) -> Option<&Arc<CompactionCancellationToken>>
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.