pub struct ConnectionPoolConfig {
pub endpoint: String,
pub max_connections: usize,
pub min_idle: usize,
pub connect_timeout: Duration,
pub max_retries: u32,
pub retry_base_delay: Duration,
pub retry_max_delay: Duration,
pub max_lifetime: Duration,
pub health_check_interval: Duration,
}Expand description
Configuration for the connection pool.
Fields§
§endpoint: StringTarget endpoint address (e.g., “http://127.0.0.1:50051”).
max_connections: usizeMaximum number of connections in the pool.
min_idle: usizeMinimum number of idle connections to keep warm.
connect_timeout: DurationConnection timeout.
max_retries: u32Maximum number of retries on connection failure.
retry_base_delay: DurationBase delay between retries (exponential backoff base).
retry_max_delay: DurationMaximum delay between retries.
max_lifetime: DurationMaximum lifetime of a connection before forced recycling.
health_check_interval: DurationHealth check interval for idle connections.
Implementations§
Source§impl ConnectionPoolConfig
impl ConnectionPoolConfig
Sourcepub fn with_max_connections(self, max: usize) -> Self
pub fn with_max_connections(self, max: usize) -> Self
Set the maximum pool size.
Sourcepub fn with_min_idle(self, min: usize) -> Self
pub fn with_min_idle(self, min: usize) -> Self
Set the minimum idle connections.
Sourcepub fn with_max_retries(self, retries: u32) -> Self
pub fn with_max_retries(self, retries: u32) -> Self
Set the maximum retries.
Sourcepub fn with_connect_timeout(self, timeout: Duration) -> Self
pub fn with_connect_timeout(self, timeout: Duration) -> Self
Set the connection timeout.
Sourcepub fn with_retry_base_delay(self, delay: Duration) -> Self
pub fn with_retry_base_delay(self, delay: Duration) -> Self
Set the retry base delay.
Sourcepub fn with_max_lifetime(self, lifetime: Duration) -> Self
pub fn with_max_lifetime(self, lifetime: Duration) -> Self
Set the maximum connection lifetime.
Trait Implementations§
Source§impl Clone for ConnectionPoolConfig
impl Clone for ConnectionPoolConfig
Source§fn clone(&self) -> ConnectionPoolConfig
fn clone(&self) -> ConnectionPoolConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Wrap the input message
T in a tonic::Request