[][src]Struct tang_rs::Builder

pub struct Builder { /* fields omitted */ }

Implementations

impl Builder[src]

pub fn new() -> Builder[src]

pub fn max_size(self, max_size: usize) -> Builder[src]

pub fn min_idle(self, min_idle: usize) -> Builder[src]

pub fn always_check(self, always_check: bool) -> Builder[src]

If true, the health of a connection will be verified when checkout.

This check uses Builder's connection_timeout setting to cancel the check and return a timeout error.

Defaults to true.

pub fn use_gc(self, use_gc: bool) -> Builder[src]

If true, the pending connections that last for too long will be removed.( 6 times the connection_timeout duration)

This is a placeholder feature. it works fine but in most cases it's not necessary or useful.

Defaults to false.

pub fn max_lifetime(self, max_lifetime: Option<Duration>) -> Builder[src]

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 reaches its maximum lifetime while checked out it will be closed when it is returned to the pool.

Defaults to 30 minutes.

pub fn idle_timeout(self, idle_timeout: Option<Duration>) -> Builder[src]

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.

pub fn reaper_rate(self, reaper_rate: Duration) -> Builder[src]

Sets the connection reaper rate.

The connection that are idle and live beyond the time gate will be dropped.

Default 15 seconds.(no guarantee as we don't force lock the pool)

pub fn connection_timeout(self, connection_timeout: Duration) -> Builder[src]

Sets the connection timeout used by the pool.

Attempt to establish new connection to database will be canceled and return a timeout error if this Duration passed.

It's recommended to set this duration the same or a bit longer than your database connection timeout setting.

Default 10 seconds.

pub fn wait_timeout(self, wait_timeout: Duration) -> Builder[src]

Sets the wait timeout used by the queue.

Similar to connection_timeout. A timeout error will return if we wait too long for a connection from pool.

Default 20 seconds

pub async fn build<M: Manager>(self, manager: M) -> Result<Pool<M>, M::Error>[src]

Consumes the Builder, returning a new, initialized Pool.

pub fn build_uninitialized<M: Manager>(self, manager: M) -> Pool<M>[src]

Consumes the Builder, returning a new uninitialized Pool.

(Pool have no connection and scheduled tasks like connection reaper and garbage collect)

pub fn get_reaper_rate(&self) -> Duration[src]

expose reaper_rate to public.

Trait Implementations

impl Default for Builder[src]

Auto Trait Implementations

impl RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl UnwindSafe for Builder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.