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 with_queue_config(
connections: Vec<CaConnection>,
config: PoolConfig,
queue_config: QueueConfig,
) -> Self
pub fn with_queue_config( connections: Vec<CaConnection>, config: PoolConfig, queue_config: QueueConfig, ) -> Self
Create a new pool with explicit queue-and-retry 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 select_allowed(&self, allowed: &[String]) -> Option<CaConnection>
pub fn select_allowed(&self, allowed: &[String]) -> Option<CaConnection>
Select only within the caller’s authorized CA set.
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.
Sourcepub fn is_queue_and_retry(&self) -> bool
pub fn is_queue_and_retry(&self) -> bool
Whether the fallback behavior is queue-and-retry.
Sourcepub fn enqueue_request(&self, csr_der: Vec<u8>) -> EnqueueResult
pub fn enqueue_request(&self, csr_der: Vec<u8>) -> EnqueueResult
Enqueue a CSR for later retry when all CAs are down.
Drains expired entries before inserting. Returns EnqueueResult::Queued
with a suggested Retry-After value on success, or
EnqueueResult::QueueFull if the queue is at capacity.
Sourcepub fn drain_queue(&self) -> Vec<QueuedRequest>
pub fn drain_queue(&self) -> Vec<QueuedRequest>
Drain all non-expired queued requests for processing.
Called when a CA becomes available to process the backlog. Returns queued requests that have not exceeded the TTL.
Sourcepub fn queue_depth(&self) -> usize
pub fn queue_depth(&self) -> usize
Current number of queued requests (for monitoring).
Sourcepub fn queue_config(&self) -> &QueueConfig
pub fn queue_config(&self) -> &QueueConfig
Queue 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