pub struct PoolConfig {
pub max_in_flight: Option<usize>,
pub governor_acquire_timeout: Duration,
pub max_connections_per_provider: usize,
pub min_idle_connections: usize,
pub idle_timeout: Duration,
pub max_lifetime: Duration,
pub health_check_interval: Duration,
pub acquire_timeout: Duration,
pub enable_health_check: bool,
}Expand description
Configuration for the client pool
Fields§
§max_in_flight: Option<usize>Maximum number of in-flight dispatches admitted per provider.
None (default) keeps admission unlimited — governed wrappers are
never installed and behavior is unchanged. See ProviderGovernor
for the WHO-vs-HOW-MUCH throttle split: this caps how much load one
backend absorbs; tenant-level quotas decide who may call at all.
governor_acquire_timeout: DurationMaximum time a dispatch waits for an in-flight slot before failing
closed (only relevant when max_in_flight is set).
max_connections_per_provider: usizeMaximum number of clients per provider (default: 10)
min_idle_connections: usizeMinimum number of idle clients to maintain per provider (default: 2)
idle_timeout: DurationMaximum time a client can be idle before being considered stale (default: 5 minutes)
max_lifetime: DurationMaximum lifetime of a client before forced refresh (default: 30 minutes)
health_check_interval: DurationHow often to run health checks on idle connections (default: 60 seconds)
acquire_timeout: DurationTimeout for acquiring a client from the pool (default: 30 seconds)
enable_health_check: boolWhether to enable connection health checking (default: true)
Implementations§
Source§impl PoolConfig
impl PoolConfig
Sourcepub fn with_max_connections(self, max: usize) -> Self
pub fn with_max_connections(self, max: usize) -> Self
Create a new pool config with custom max connections
Sourcepub fn with_max_in_flight(self, max: usize) -> Self
pub fn with_max_in_flight(self, max: usize) -> Self
Enable a per-provider in-flight cap of max concurrent dispatches.
Admission happens at the wrap funnel ([ProviderPool::acquire] and
[ProviderPool::try_acquire]) so every checkout path — pooled or
freshly created clients alike — is governed identically. The permit
spans the whole call, streams included.
Sourcepub fn with_governor_acquire_timeout(self, timeout: Duration) -> Self
pub fn with_governor_acquire_timeout(self, timeout: Duration) -> Self
Set the wait budget for acquiring an in-flight slot.
Sourcepub fn governor_config(&self) -> GovernorConfig
pub fn governor_config(&self) -> GovernorConfig
Effective governor configuration for this pool.
Sourcepub fn with_idle_timeout(self, timeout: Duration) -> Self
pub fn with_idle_timeout(self, timeout: Duration) -> Self
Create a new pool config with custom idle timeout
Sourcepub fn with_max_lifetime(self, lifetime: Duration) -> Self
pub fn with_max_lifetime(self, lifetime: Duration) -> Self
Create a new pool config with custom max lifetime
Sourcepub fn without_health_check(self) -> Self
pub fn without_health_check(self) -> Self
Disable health checking (useful for testing)
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§fn clone(&self) -> PoolConfig
fn clone(&self) -> PoolConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more