pub struct OpenAndCompactOptions { /* private fields */ }Expand description
Extra controls for open_and_compact_with_options.
These are RocksDB’s OpenAndCompactOptions from options.h.
Implementations§
Source§impl OpenAndCompactOptions
impl OpenAndCompactOptions
Sourcepub fn set_allow_resumption(&mut self, allow_resumption: bool)
pub fn set_allow_resumption(&mut self, allow_resumption: bool)
Lets the compaction pick up where an earlier interrupted run left off.
With this on, the worker reads any progress left in the output directory and writes new progress there as each output file completes, so a retried job only redoes the file it was in the middle of. If the saved state cannot be used, it cleans the directory and starts fresh.
With this off, which is the default, the output directory must be empty before the call. Upstream is explicit that leftover files there can cause correctness errors.
Upstream marks this experimental and notes it does nothing when
paranoid_file_checks is on.
Sourcepub fn allow_resumption(&self) -> bool
pub fn allow_resumption(&self) -> bool
Whether resumption is on. See Self::set_allow_resumption.
Sourcepub fn set_canceled(&mut self, token: Arc<OpenAndCompactCancellationToken>)
pub fn set_canceled(&mut self, token: Arc<OpenAndCompactCancellationToken>)
Attaches a cancellation token so another thread can abort the compaction.
The C side stores the token as a borrowed std::atomic<bool>* inside
the options struct (c.cc:1563), so the flag has to outlive both these
options and the open_and_compact_with_options call that reads them.
Holding an Arc clone enforces that at runtime and keeps
OpenAndCompactOptions free of a lifetime parameter. Sharing the token
is also the normal case, since something on another thread has to own a
handle in order to cancel.
There is no way to detach a token once attached. The C API ignores a null argument rather than clearing the field (c.cc:1562).
Sourcepub fn canceled(&self) -> Option<&Arc<OpenAndCompactCancellationToken>>
pub fn canceled(&self) -> Option<&Arc<OpenAndCompactCancellationToken>>
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.