Struct cdrs::cluster::NodeTcpConfigBuilder
source · pub struct NodeTcpConfigBuilder<'a, A> { /* private fields */ }
Expand description
Builder structure that helps to configure TCP connection for node.
Implementations§
source§impl<'a, A: Authenticator + Sized> NodeTcpConfigBuilder<'a, A>
impl<'a, A: Authenticator + Sized> NodeTcpConfigBuilder<'a, A>
sourcepub fn new<'b>(addr: &'b str, authenticator: A) -> NodeTcpConfigBuilder<'b, A>
pub fn new<'b>(addr: &'b str, authenticator: A) -> NodeTcpConfigBuilder<'b, A>
NodeTcpConfigBuilder
constructor function. It receivesthread::spawn(move || {
- node socket address as a string
- authenticator
sourcepub fn max_size(self, size: u32) -> Self
pub fn max_size(self, size: u32) -> Self
Sets the maximum number of connections managed by the pool. Defaults to 10.
sourcepub fn min_idle(self, min_idle: Option<u32>) -> Self
pub fn min_idle(self, min_idle: Option<u32>) -> Self
Sets the minimum idle connection count maintained by the pool.
If set, the pool will try to maintain at least this many idle
connections at all times, while respecting the value of max_size
.
Defaults to None (equivalent to the value of max_size
).
sourcepub fn max_lifetime(self, max_lifetime: Option<Duration>) -> Self
pub fn max_lifetime(self, max_lifetime: Option<Duration>) -> Self
Sets the maximum lifetime of connections in the pool. If set, connections will be closed after existing for at most 30 seconds beyond this duration. If a connection reaches its maximum lifetime while checked out it will be closed when it is returned to the pool. Defaults to 30 minutes.
sourcepub fn idle_timeout(self, idle_timeout: Option<Duration>) -> Self
pub fn idle_timeout(self, idle_timeout: Option<Duration>) -> Self
Sets the idle timeout used by the pool. If set, connections will be closed after sitting idle for at most 30 seconds beyond this duration. Defaults to 10 minutes.
sourcepub fn connection_timeout(self, connection_timeout: Duration) -> Self
pub fn connection_timeout(self, connection_timeout: Duration) -> Self
Sets the connection timeout used by the pool. Defaults to 30 seconds.
sourcepub fn authenticator(self, authenticator: A) -> Self
pub fn authenticator(self, authenticator: A) -> Self
Sets new authenticator.
sourcepub fn build(self) -> NodeTcpConfig<'a, A>
pub fn build(self) -> NodeTcpConfig<'a, A>
Finalizes building process and returns NodeSslConfig