Struct LruDropPool
pub struct LruDropPool<C, ID> { /* private fields */ }
Expand description
Connection pool that uses LRU to evict connections
Implementations§
§impl<C, ID> LruDropPool<C, ID>
impl<C, ID> LruDropPool<C, ID>
pub fn new( max_active: usize, max_total: usize, ) -> Result<LruDropPool<C, ID>, OpaqueError>
pub fn maybe_with_idle_timeout(
self,
timeout: Option<Duration>,
) -> LruDropPool<C, ID>
pub fn maybe_with_idle_timeout( self, timeout: Option<Duration>, ) -> LruDropPool<C, ID>
If connections have been idle for longer then the provided timeout they will be dropped and removed from the pool
Note: timeout is only checked when a connection is requested from the pool, it is not something that is done periodically
pub fn maybe_set_idle_timeout(
&mut self,
timeout: Option<Duration>,
) -> &mut LruDropPool<C, ID>
pub fn maybe_set_idle_timeout( &mut self, timeout: Option<Duration>, ) -> &mut LruDropPool<C, ID>
If connections have been idle for longer then the provided timeout they will be dropped and removed from the pool
Note: timeout is only checked when a connection is requested from the pool, it is not something that is done periodically
pub fn with_idle_timeout(self, timeout: Duration) -> LruDropPool<C, ID>
pub fn with_idle_timeout(self, timeout: Duration) -> LruDropPool<C, ID>
If connections have been idle for longer then the provided timeout they will be dropped and removed from the pool
Note: timeout is only checked when a connection is requested from the pool, it is not something that is done periodically
pub fn set_idle_timeout(&mut self, timeout: Duration) -> &mut LruDropPool<C, ID>
pub fn set_idle_timeout(&mut self, timeout: Duration) -> &mut LruDropPool<C, ID>
If connections have been idle for longer then the provided timeout they will be dropped and removed from the pool
Note: timeout is only checked when a connection is requested from the pool, it is not something that is done periodically
pub fn without_idle_timeout(self) -> LruDropPool<C, ID>
pub fn without_idle_timeout(self) -> LruDropPool<C, ID>
If connections have been idle for longer then the provided timeout they will be dropped and removed from the pool
Note: timeout is only checked when a connection is requested from the pool, it is not something that is done periodically
pub fn unset_idle_timeout(&mut self) -> &mut LruDropPool<C, ID>
pub fn unset_idle_timeout(&mut self) -> &mut LruDropPool<C, ID>
If connections have been idle for longer then the provided timeout they will be dropped and removed from the pool
Note: timeout is only checked when a connection is requested from the pool, it is not something that is done periodically
pub fn with_reuse_strategy(self, strategy: ReuseStrategy) -> LruDropPool<C, ID>
pub fn set_reuse_strategy( &mut self, strategy: ReuseStrategy, ) -> &mut LruDropPool<C, ID>
pub fn maybe_with_metrics( self, metrics: Option<Arc<PoolMetrics>>, ) -> LruDropPool<C, ID>
pub fn maybe_set_metrics( &mut self, metrics: Option<Arc<PoolMetrics>>, ) -> &mut LruDropPool<C, ID>
pub fn with_metrics(self, metrics: Arc<PoolMetrics>) -> LruDropPool<C, ID>
pub fn set_metrics( &mut self, metrics: Arc<PoolMetrics>, ) -> &mut LruDropPool<C, ID>
pub fn without_metrics(self) -> LruDropPool<C, ID>
pub fn unset_metrics(&mut self) -> &mut LruDropPool<C, ID>
Trait Implementations§
§impl<C, ID> Clone for LruDropPool<C, ID>
impl<C, ID> Clone for LruDropPool<C, ID>
§fn clone(&self) -> LruDropPool<C, ID>
fn clone(&self) -> LruDropPool<C, ID>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<C, ID> Debug for LruDropPool<C, ID>where
ID: Debug,
impl<C, ID> Debug for LruDropPool<C, ID>where
ID: Debug,
§impl<C, ID> Pool<C, ID> for LruDropPool<C, ID>
impl<C, ID> Pool<C, ID> for LruDropPool<C, ID>
type Connection = LeasedConnection<C, ID>
type CreatePermit = (ActiveSlot, PoolSlot)
§async fn get_conn(
&self,
id: &ID,
) -> Result<ConnectionResult<<LruDropPool<C, ID> as Pool<C, ID>>::Connection, <LruDropPool<C, ID> as Pool<C, ID>>::CreatePermit>, OpaqueError>
async fn get_conn( &self, id: &ID, ) -> Result<ConnectionResult<<LruDropPool<C, ID> as Pool<C, ID>>::Connection, <LruDropPool<C, ID> as Pool<C, ID>>::CreatePermit>, OpaqueError>
Pool::CreatePermit
is returned Read more§async fn create(
&self,
id: ID,
conn: C,
permit: <LruDropPool<C, ID> as Pool<C, ID>>::CreatePermit,
) -> <LruDropPool<C, ID> as Pool<C, ID>>::Connection
async fn create( &self, id: ID, conn: C, permit: <LruDropPool<C, ID> as Pool<C, ID>>::CreatePermit, ) -> <LruDropPool<C, ID> as Pool<C, ID>>::Connection
Auto Trait Implementations§
impl<C, ID> Freeze for LruDropPool<C, ID>
impl<C, ID> !RefUnwindSafe for LruDropPool<C, ID>
impl<C, ID> Send for LruDropPool<C, ID>
impl<C, ID> Sync for LruDropPool<C, ID>
impl<C, ID> Unpin for LruDropPool<C, ID>
impl<C, ID> !UnwindSafe for LruDropPool<C, ID>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more