pub struct CompactionCancellationToken { /* private fields */ }Expand description
A cancellation flag that aborts an in progress CompactFiles job.
Create one, hand it to CompactionOptions::set_canceled, keep a clone of the Arc
somewhere else, and call cancel from that other thread to stop the
compaction. Cancellation is one shot and best effort. The compaction iterator checks the
flag as it walks the input, so the job stops at the next check rather than immediately,
and upstream notes that cancellation can be delayed waiting on automatic compactions when
exclusive_manual_compaction is set.
There is no C API to read the flag back, so this wrapper is write only and there is no way to un-cancel. Use a fresh token per compaction.
Implementations§
Source§impl CompactionCancellationToken
impl CompactionCancellationToken
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Signals that the compaction using this token should stop.
Returns as soon as the flag is stored. The compaction winds down on its own thread and
the CompactFiles call it belongs to then fails with
ErrorKind::Incomplete and the message
Result incomplete: Manual compaction paused.