pub struct CaPool { /* private fields */ }Expand description
Thread-safe pool of CA backend connections.
Routes enrollment requests to healthy CAs based on the configured
FailoverStrategy. The pool is updated by the super::health::HealthChecker
and read by request handlers concurrently.
Implementations§
Source§impl CaPool
impl CaPool
Sourcepub fn new(connections: Vec<CaConnection>, config: PoolConfig) -> Self
pub fn new(connections: Vec<CaConnection>, config: PoolConfig) -> Self
Create a new pool with the given backends and configuration.
Sourcepub fn select(&self) -> Option<CaConnection>
pub fn select(&self) -> Option<CaConnection>
Select the best available CA for an enrollment request.
Returns None when no healthy CA is available and the fallback
behavior is FallbackBehavior::Reject.
Sourcepub fn record_success(&self, id: &CaId, latency: Duration)
pub fn record_success(&self, id: &CaId, latency: Duration)
Record a successful request to a CA, updating latency EMA.
Sourcepub fn record_failure(&self, id: &CaId)
pub fn record_failure(&self, id: &CaId)
Record a failed request, applying circuit-breaker logic (RHELBU-3536 R2).
Sourcepub fn should_reprobe(&self, id: &CaId) -> bool
pub fn should_reprobe(&self, id: &CaId) -> bool
Check whether a tripped circuit breaker should allow a re-probe.
Sourcepub fn set_health(&self, id: &CaId, state: HealthState)
pub fn set_health(&self, id: &CaId, state: HealthState)
Update the health state for a CA (called by the health checker).
Sourcepub fn status_snapshot(&self) -> HashMap<CaId, CaStatus>
pub fn status_snapshot(&self) -> HashMap<CaId, CaStatus>
Snapshot of current statuses for monitoring.
Sourcepub fn connections(&self) -> &[CaConnection]
pub fn connections(&self) -> &[CaConnection]
All registered CA connections.
Sourcepub fn config(&self) -> &PoolConfig
pub fn config(&self) -> &PoolConfig
Pool configuration.
Auto Trait Implementations§
impl !Freeze for CaPool
impl !RefUnwindSafe for CaPool
impl Send for CaPool
impl Sync for CaPool
impl Unpin for CaPool
impl UnsafeUnpin for CaPool
impl UnwindSafe for CaPool
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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