atomic-circuit-breaker 11.2.0

Zero-dependency, lock-free atomic sliding-window circuit breaker with CAS probe gating, monotonic clock support, and RAII guards.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::*;

/// Zero-dependency, lock-free atomic sliding-window circuit breaker.
#[derive(Debug)]
pub struct CircuitBreaker {
    /// Validated immutable circuit-breaker configuration.
    pub(crate) config: CircuitBreakerConfig,
    /// Monotonic nanosecond clock anchored at creation.
    pub(crate) clock: CircuitClock,
    /// Cache-line-isolated packed `(state_2 | generation_30 | hi_aux_16 | lo_aux_16)` state word.
    pub(crate) state_word: CachePadded<AtomicU64>,
    /// Cache-line-isolated generation-indexed open timestamp slots (`generation & 7`).
    pub(crate) opened_at_slots: CachePadded<[AtomicU64; OPENED_AT_SLOTS]>,
    /// Inline 16-bucket lock-free sliding window for failure-count and failure-rate evaluation.
    pub(crate) window: SlidingWindow,
}