pub struct Compactor { /* private fields */ }Expand description
Background compaction handle.
Implementations§
Source§impl Compactor
impl Compactor
Sourcepub fn start(
compact_fn: impl Fn() -> DbResult<usize> + Send + 'static,
interval: Duration,
) -> Self
pub fn start( compact_fn: impl Fn() -> DbResult<usize> + Send + 'static, interval: Duration, ) -> Self
Start a background compaction thread with its own shutdown signal.
Sourcepub fn start_with_signal(
compact_fn: impl Fn() -> DbResult<usize> + Send + 'static,
interval: Duration,
signal: ShutdownSignal,
) -> Self
pub fn start_with_signal( compact_fn: impl Fn() -> DbResult<usize> + Send + 'static, interval: Duration, signal: ShutdownSignal, ) -> Self
Start a background compaction thread controlled by an external shutdown signal. When the signal fires the thread wakes up immediately instead of waiting for the full sleep interval.
pub fn stop(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compactor
impl !RefUnwindSafe for Compactor
impl Send for Compactor
impl Sync for Compactor
impl Unpin for Compactor
impl UnsafeUnpin for Compactor
impl !UnwindSafe for Compactor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more