Struct bb8::Builder [−][src]
pub struct Builder<M: ManageConnection> { /* fields omitted */ }
Expand description
A builder for a connection pool.
Implementations
Constructs a new Builder
.
Parameters are initialized with their default values.
Sets the maximum number of connections managed by the pool.
Defaults to 10.
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.
If true, the health of a connection will be verified through a call to
ManageConnection::is_valid
before it is provided to a pool user.
Defaults to true.
Sets the maximum lifetime of connections in the pool.
If set, connections will be closed at the next reaping after surviving past this duration.
If a connection reachs its maximum lifetime while checked out it will be closed when it is returned to the pool.
Defaults to 30 minutes.
Sets the idle timeout used by the pool.
If set, idle connections in excess of min_idle
will be closed at the
next reaping after remaining idle past this duration.
Defaults to 10 minutes.
Sets the connection timeout used by the pool.
Futures returned by Pool::get
will wait this long before giving up and
resolving with an error.
Defaults to 30 seconds.
Set the sink for errors that are not associated with any particular operation on the pool. This can be used to log and monitor failures.
Defaults to NopErrorSink
.
Used by tests
pub fn connection_customizer(
self,
connection_customizer: Box<dyn CustomizeConnection<M::Connection, M::Error>>
) -> Builder<M>
pub fn connection_customizer(
self,
connection_customizer: Box<dyn CustomizeConnection<M::Connection, M::Error>>
) -> Builder<M>
Set the connection customizer to customize newly checked out connections
Consumes the builder, returning a new, initialized Pool
.
The Pool
will not be returned until it has established its configured
minimum number of connections, or it times out.
Consumes the builder, returning a new, initialized Pool
.
Unlike build
, this does not wait for any connections to be established
before returning.