pub struct CompactionCircuitBreaker { /* private fields */ }Expand description
Circuit breaker that gates compaction calls after repeated failures.
When consecutive compaction failures reach the configured threshold, the breaker opens and all proactive compaction is skipped for the remainder of the run. Reactive compaction (triggered by a provider context overflow error) is still attempted.
Implementations§
Source§impl CompactionCircuitBreaker
impl CompactionCircuitBreaker
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Records a successful compaction, resetting the failure count and closing the breaker.
Sourcepub fn record_failure(&mut self) -> bool
pub fn record_failure(&mut self) -> bool
Records a failed compaction. If the failure count reaches the
threshold, the breaker opens. Returns true when the breaker
transitions from closed to open (so the caller can emit an event).
Sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Returns true when the breaker is open and proactive compaction
should be skipped.
Sourcepub fn consecutive_failures(&self) -> u32
pub fn consecutive_failures(&self) -> u32
Returns the number of consecutive failures recorded so far.
Trait Implementations§
Source§impl Clone for CompactionCircuitBreaker
impl Clone for CompactionCircuitBreaker
Source§fn clone(&self) -> CompactionCircuitBreaker
fn clone(&self) -> CompactionCircuitBreaker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CompactionCircuitBreaker
impl RefUnwindSafe for CompactionCircuitBreaker
impl Send for CompactionCircuitBreaker
impl Sync for CompactionCircuitBreaker
impl Unpin for CompactionCircuitBreaker
impl UnsafeUnpin for CompactionCircuitBreaker
impl UnwindSafe for CompactionCircuitBreaker
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