#[non_exhaustive]pub struct BreakerConfig {
pub failure_threshold: u32,
pub open_for: Duration,
pub half_open_probes: u32,
}Expand description
Per-replica circuit breaker thresholds.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.failure_threshold: u32Consecutive failures that open the breaker, quarantining that endpoint.
open_for: DurationHow long an open breaker rejects a replica before probing again.
Also bounds how long a batch parked behind a fully-probing shard waits
before re-checking of its own accord (clamped to [100ms, 30s]).
Capped at a year on the way in: it is stamped into a deadline, and
Instant + Duration panics rather than saturating.
half_open_probes: u32Concurrent probe writes allowed while half-open.
Must be at least 1; validate rejects 0, which
taken literally would mean the replica never recovers. The breaker also
floors it at 1 at the point of use, so a config built programmatically
rather than loaded cannot wedge a replica either.
Implementations§
Source§impl BreakerConfig
impl BreakerConfig
Sourcepub const MAX_OPEN_FOR: Duration
pub const MAX_OPEN_FOR: Duration
Ceiling on open_for.
It is stamped into a deadline, and Instant + Duration panics rather
than saturating. A year already means “never probe again”, so anything
beyond it is a typo rather than a policy.
Sourcepub fn validate(&self) -> Result<(), BreakerConfigError>
pub fn validate(&self) -> Result<(), BreakerConfigError>
Reject breaker thresholds that would misbehave at runtime.
The companion to RetryConfig::validate, called from the same place
for the same reason: the rules stay here instead of being mirrored per
connector.
§Errors
BreakerConfigError, naming the offending key.
use spate_core::sink::{BreakerConfig, BreakerConfigError};
assert!(BreakerConfig::default().validate().is_ok());
let mut wedged = BreakerConfig::default();
wedged.half_open_probes = 0;
assert_eq!(wedged.validate(), Err(BreakerConfigError::ZeroHalfOpenProbes));Trait Implementations§
Source§impl Clone for BreakerConfig
impl Clone for BreakerConfig
Source§fn clone(&self) -> BreakerConfig
fn clone(&self) -> BreakerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BreakerConfig
Source§impl Debug for BreakerConfig
impl Debug for BreakerConfig
Source§impl Default for BreakerConfig
impl Default for BreakerConfig
Source§impl<'de> Deserialize<'de> for BreakerConfigwhere
BreakerConfig: Default,
impl<'de> Deserialize<'de> for BreakerConfigwhere
BreakerConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for BreakerConfig
Source§impl PartialEq for BreakerConfig
impl PartialEq for BreakerConfig
impl StructuralPartialEq for BreakerConfig
Auto Trait Implementations§
impl Freeze for BreakerConfig
impl RefUnwindSafe for BreakerConfig
impl Send for BreakerConfig
impl Sync for BreakerConfig
impl Unpin for BreakerConfig
impl UnsafeUnpin for BreakerConfig
impl UnwindSafe for BreakerConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.