pub struct ConnectionPoolConfig {
pub max_connections: usize,
pub min_idle: usize,
pub connect_timeout: Duration,
pub acquire_timeout: Duration,
pub health_check_interval: Duration,
pub max_lifetime: Duration,
pub idle_timeout: Duration,
pub auto_reconnect: bool,
pub max_reconnect_attempts: u32,
pub reconnect_base_delay: Duration,
pub reconnect_max_delay: Duration,
pub tls_config: Option<TlsClientConfig>,
}Expand description
Configuration for connection pool
Fields§
§max_connections: usizeMaximum number of connections in the pool
min_idle: usizeMinimum number of idle connections to maintain
connect_timeout: DurationConnection timeout
acquire_timeout: DurationMaximum time to wait for a connection from the pool
health_check_interval: DurationHealth check interval (0 = disabled)
max_lifetime: DurationMaximum connection lifetime (0 = unlimited)
idle_timeout: DurationIdle timeout before closing a connection
auto_reconnect: boolEnable automatic reconnection
max_reconnect_attempts: u32Maximum reconnection attempts (0 = unlimited)
reconnect_base_delay: DurationBase delay for exponential backoff
reconnect_max_delay: DurationMaximum delay for exponential backoff
tls_config: Option<TlsClientConfig>TLS configuration (None = plain TCP)
Implementations§
Source§impl ConnectionPoolConfig
impl ConnectionPoolConfig
Sourcepub fn with_max_connections(self, n: usize) -> Self
pub fn with_max_connections(self, n: usize) -> Self
Set maximum connections
Sourcepub fn with_min_idle(self, n: usize) -> Self
pub fn with_min_idle(self, n: usize) -> Self
Set minimum idle connections
Sourcepub fn with_connect_timeout(self, timeout: Duration) -> Self
pub fn with_connect_timeout(self, timeout: Duration) -> Self
Set connection timeout
Sourcepub fn with_acquire_timeout(self, timeout: Duration) -> Self
pub fn with_acquire_timeout(self, timeout: Duration) -> Self
Set acquire timeout
Sourcepub fn with_health_check_interval(self, secs: u64) -> Self
pub fn with_health_check_interval(self, secs: u64) -> Self
Set health check interval (seconds)
Sourcepub fn with_max_lifetime(self, lifetime: Duration) -> Self
pub fn with_max_lifetime(self, lifetime: Duration) -> Self
Set maximum connection lifetime
Sourcepub fn with_idle_timeout(self, timeout: Duration) -> Self
pub fn with_idle_timeout(self, timeout: Duration) -> Self
Set idle timeout
Sourcepub fn with_auto_reconnect(self, enabled: bool) -> Self
pub fn with_auto_reconnect(self, enabled: bool) -> Self
Enable or disable auto-reconnect
Sourcepub fn with_max_reconnect_attempts(self, attempts: u32) -> Self
pub fn with_max_reconnect_attempts(self, attempts: u32) -> Self
Set maximum reconnection attempts
Sourcepub fn with_tls(self, tls_config: TlsClientConfig) -> Self
pub fn with_tls(self, tls_config: TlsClientConfig) -> Self
Set TLS configuration for encrypted connections
Trait Implementations§
Source§impl Clone for ConnectionPoolConfig
impl Clone for ConnectionPoolConfig
Source§fn clone(&self) -> ConnectionPoolConfig
fn clone(&self) -> ConnectionPoolConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionPoolConfig
impl Debug for ConnectionPoolConfig
Auto Trait Implementations§
impl Freeze for ConnectionPoolConfig
impl RefUnwindSafe for ConnectionPoolConfig
impl Send for ConnectionPoolConfig
impl Sync for ConnectionPoolConfig
impl Unpin for ConnectionPoolConfig
impl UnsafeUnpin for ConnectionPoolConfig
impl UnwindSafe for ConnectionPoolConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request