Skip to main content

ConnectionPool

Struct ConnectionPool 

Source
pub struct ConnectionPool<M: ConnectionManager> { /* private fields */ }
Expand description

Connection pool

Implementations§

Source§

impl<M> ConnectionPool<M>
where M: ConnectionManager + Send + Sync + Clone + 'static,

Source

pub fn new( max_size: Option<usize>, max_idle_time: Option<Duration>, connection_timeout: Option<Duration>, cleanup_config: Option<CleanupConfig>, manager: M, ) -> Arc<Self>

Create a new connection pool

Source

pub async fn get_connection( self: Arc<Self>, ) -> Result<ManagedConnection<M>, PoolError<M::Error>>

Get a connection from the pool

Source

pub fn outstanding_count(&self) -> usize

Source

pub async fn pool_size(&self) -> usize

Source

pub fn max_size(&self) -> usize

Source

pub async fn stop_cleanup_task(&self)

Stop the background cleanup task

Source

pub async fn restart_cleanup_task(&self, cleanup_config: CleanupConfig)

Restart the background cleanup task with new configuration

Source§

impl<A> ConnectionPool<TcpConnectionManager<A>>
where A: ToSocketAddrs + Send + Sync + Clone + 'static,

Source

pub fn new_tcp( max_size: Option<usize>, max_idle_time: Option<Duration>, connection_timeout: Option<Duration>, cleanup_config: Option<CleanupConfig>, address: A, ) -> Arc<Self>

Create a new TCP connection pool

Auto Trait Implementations§

§

impl<M> Freeze for ConnectionPool<M>
where M: Freeze,

§

impl<M> !RefUnwindSafe for ConnectionPool<M>

§

impl<M> Send for ConnectionPool<M>

§

impl<M> Sync for ConnectionPool<M>

§

impl<M> Unpin for ConnectionPool<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for ConnectionPool<M>
where M: UnsafeUnpin,

§

impl<M> !UnwindSafe for ConnectionPool<M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.