Struct r2d2::Config
[−]
[src]
pub struct Config<C, E> { /* fields omitted */ }
A struct specifying the runtime configuration of a pool.
Config
implements Default
, which provides a set of reasonable default
values. It can be constructed using a Builder
.
Methods
impl<C, E: Error> Config<C, E>
[src]
fn builder() -> Builder<C, E>
[src]
Creates a new Builder
which can be used to construct a customized
Config
.
All parameters are initialized to their default values.
fn pool_size(&self) -> u32
[src]
The maximum number of connections managed by the pool.
Defaults to 10.
fn min_idle(&self) -> Option<u32>
[src]
If set, the pool will try to maintain at least this many idle
connections at all times, while respecting the value of pool_size
.
Defaults to None (equivalent to the value of pool_size
).
fn helper_threads(&self) -> u32
[src]
: use thread_pool directly
The number of threads that the pool will use for asynchronous operations such as connection creation and health checks.
Defaults to 3.
fn test_on_check_out(&self) -> bool
[src]
If true, the health of a connection will be verified via a call to
ConnectionManager::is_valid
before it is checked out of the pool.
Defaults to true.
fn initialization_fail_fast(&self) -> bool
[src]
If true, Pool::new
will synchronously initialize its connections,
returning an error if they could not be created.
Defaults to true.
fn idle_timeout(&self) -> Option<Duration>
[src]
If set, connections will be closed after sitting idle for at most 30 seconds beyond this duration.
Defaults to 10 minutes.
fn max_lifetime(&self) -> Option<Duration>
[src]
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.
fn connection_timeout(&self) -> Duration
[src]
Calls to Pool::get
will wait this long for a connection to become
available before returning an error.
Defaults to 30 seconds.
fn error_handler(&self) -> &HandleError<E>
[src]
The handler for error reported in the pool.
Defaults to r2d2::LoggingErrorHandler
.
fn connection_customizer(&self) -> &CustomizeConnection<C, E>
[src]
The connection customizer used by the pool.
Defaults to r2d2::NopConnectionCustomizer
.
fn thread_pool(&self) -> &Arc<ScheduledThreadPool>
[src]
The thread pool that the pool will use for asynchronous operations such as connection creation and health checks.
Defaults to a new pool with helper_threads
threads.