pub struct PoolBuilder { /* private fields */ }
Expand description
A bulider to make a connection pool
Implementations§
Source§impl PoolBuilder
impl PoolBuilder
Sourcepub fn new<U, P, C>(username: U, password: P, connect_string: C) -> PoolBuilder
pub fn new<U, P, C>(username: U, password: P, connect_string: C) -> PoolBuilder
Creates a builder to make a connection pool.
Sourcepub fn min_connections(&mut self, num: u32) -> &mut PoolBuilder
pub fn min_connections(&mut self, num: u32) -> &mut PoolBuilder
Specifies the minimum number of connections to be created by the connection pool.
This value is ignored if the pool type is PoolType::Heterogeneous
.
The default value is 1.
See also Pool::reconfigure
.
Sourcepub fn max_connections(&mut self, num: u32) -> &mut PoolBuilder
pub fn max_connections(&mut self, num: u32) -> &mut PoolBuilder
Specifies the maximum number of connections that can be created by the connection pool. Values of 1 and higher are acceptable. The default value is 1.
See also Pool::reconfigure
.
Sourcepub fn connection_increment(&mut self, num: u32) -> &mut PoolBuilder
pub fn connection_increment(&mut self, num: u32) -> &mut PoolBuilder
Specifies the number of connections that will be created by the connection pool
when more connections are required and the number of connection is less than
the maximum allowed. This value is ignored if the pool type is PoolType::Heterogeneous
.
This value added to the PoolBuilder::min_connections
value
must not exceed the PoolBuilder::max_connections
.
The default value is 0.
See also Pool::reconfigure
.
Sourcepub fn ping_interval(
&mut self,
dur: Option<Duration>,
) -> Result<&mut PoolBuilder>
pub fn ping_interval( &mut self, dur: Option<Duration>, ) -> Result<&mut PoolBuilder>
Specifies the length of time since a connection has last been used
before a ping will be performed to verify that the connection is still
valid. A None
value disables this check. The default value is 60 seconds.
See also Pool::ping_interval
and Pool::set_ping_interval
.
Sourcepub fn ping_timeout(&mut self, dur: Duration) -> Result<&mut PoolBuilder>
pub fn ping_timeout(&mut self, dur: Duration) -> Result<&mut PoolBuilder>
Specifies the length of time to wait when performing a ping to verify the connection is still valid before the connection is considered invalid and is dropped. The default value is 5 seconds.
Sourcepub fn pool_type(&mut self, pool_type: PoolType) -> &mut PoolBuilder
pub fn pool_type(&mut self, pool_type: PoolType) -> &mut PoolBuilder
Specifies whether the pool is homogeneous or heterogeneous. In a homogeneous pool all
connections use the same credentials whereas in a heterogeneous pool other
credentials are permitted. The default value is PoolType::Homogeneous
.
Sourcepub fn external_auth(&mut self, b: bool) -> &mut PoolBuilder
pub fn external_auth(&mut self, b: bool) -> &mut PoolBuilder
Specifies whether external authentication should be used to create the
connections in the pool. If this value is false
, the user name and password values
must be specified in the call to PoolBuilder::new
; otherwise, the
username and password values must be empty. The default
value is false
. External authentication cannot be used with homogeneous pools.
Sourcepub fn get_mode(&mut self, mode: GetMode) -> &mut PoolBuilder
pub fn get_mode(&mut self, mode: GetMode) -> &mut PoolBuilder
Specifies the mode to use when connections are acquired from the pool.
The default value is GetMode::NoWait
.
See also Pool::get_mode
and Pool::set_get_mode
.
Sourcepub fn timeout(&mut self, dur: Duration) -> Result<&mut PoolBuilder>
pub fn timeout(&mut self, dur: Duration) -> Result<&mut PoolBuilder>
Specifies the length of time after which idle connections in the
pool are terminated. Note that termination only occurs when the pool is
accessed. The default value is Duration::ZERO
which means that no idle connections are
terminated.
See also Pool::timeout
and Pool::set_timeout
.
Sourcepub fn max_lifetime_connection(
&mut self,
dur: Duration,
) -> Result<&mut PoolBuilder>
pub fn max_lifetime_connection( &mut self, dur: Duration, ) -> Result<&mut PoolBuilder>
Specifies the maximum length of time a pooled connection may
exist. Connections in use will not be closed. They become candidates for
termination only when they are released back to the pool and have existed
for longer than max_lifetime_connection. Connection termination only occurs
when the pool is accessed. The default value is Duration::ZERO
which means that there is
no maximum length of time that a pooled connection may exist.
See also Pool::max_lifetime_connection
and Pool::set_max_lifetime_connection
.
Sourcepub fn plsql_fixup_callback<T>(&mut self, plsql: T) -> &mut PoolBuilder
pub fn plsql_fixup_callback<T>(&mut self, plsql: T) -> &mut PoolBuilder
Specifies the name of a PL/SQL procedure in the format schema.package.callback_proc which will be called when a connection is checked out from the pool and the requested tag doesn’t match the actual tag assigned to the connection. The procedure accepts the desired and actual tags as parameters and it is the responsibility of the procedure to ensure that the connection matches the desired state upon completion. See the OCI documentation for more information. This functionality is only available when Oracle Client is at version 12.2 and higher.
Sourcepub fn max_connections_per_shard(&mut self, num: u32) -> &mut PoolBuilder
pub fn max_connections_per_shard(&mut self, num: u32) -> &mut PoolBuilder
Specifies the maximum number of connections that can be created by the connection pool for each shard in a sharded database. Set this attribute to a value other than zero to ensure that the pool is balanced towards each shard. A value of zero will not set any maximum number of connections for each shard. If the Oracle client library version is less than 18.3, this value is ignored.
See also Pool::max_connections_per_shard
and Pool::set_max_connections_per_shard
.
Sourcepub fn events(&mut self, b: bool) -> &mut PoolBuilder
pub fn events(&mut self, b: bool) -> &mut PoolBuilder
Reserved for when advanced queuing (AQ) or continuous query notification (CQN) is supported.
Sourcepub fn edition<S>(&mut self, edition: S) -> &mut PoolBuilder
pub fn edition<S>(&mut self, edition: S) -> &mut PoolBuilder
Specifies edition of Edition-Based Redefinition.
Sourcepub fn driver_name<S>(&mut self, driver_name: S) -> &mut PoolBuilder
pub fn driver_name<S>(&mut self, driver_name: S) -> &mut PoolBuilder
Sets the driver name displayed in V$SESSION_CONNECT_INFO.CLIENT_DRIVER.
The default value is “rust-oracle : version number”. Only the first 8 chracters “rust-ora” are displayed when the Oracle server version is lower than 12.0.1.2.
Sourcepub fn stmt_cache_size(&mut self, size: u32) -> &mut PoolBuilder
pub fn stmt_cache_size(&mut self, size: u32) -> &mut PoolBuilder
Specifies the number of statements to retain in the statement cache. Use a value of 0 to disable the statement cache completely. The default value is 20.
See also Pool::stmt_cache_size
and Pool::set_stmt_cache_size
.
Trait Implementations§
Source§impl Clone for PoolBuilder
impl Clone for PoolBuilder
Source§fn clone(&self) -> PoolBuilder
fn clone(&self) -> PoolBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more