Struct LruDropPool
pub struct LruDropPool<C, ID> { /* private fields */ }net only.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 try_new( max_active: usize, max_total: usize, ) -> Result<LruDropPool<C, ID>, Box<dyn Error + Send + Sync>>
pub fn retire(&self)
pub fn retire(&self)
Retire this pool generation and close every idle connection.
Connections that are currently leased are closed when returned. New acquisitions fail, including acquisitions through another clone of this pool.
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 with_drop_connection_if_no_response(
self,
drop_connection_if_no_response: bool,
) -> LruDropPool<C, ID>
pub fn with_drop_connection_if_no_response( self, drop_connection_if_no_response: bool, ) -> LruDropPool<C, ID>
If enabled (the default), connections that did not receive a response will be evicted from the pool instead of being returned for reuse.
This includes timeouts, cancellations, and errors.
pub fn set_drop_connection_if_no_response(
&mut self,
drop_connection_if_no_response: bool,
) -> &mut LruDropPool<C, ID>
pub fn set_drop_connection_if_no_response( &mut self, drop_connection_if_no_response: bool, ) -> &mut LruDropPool<C, ID>
If enabled (the default), connections that did not receive a response will be evicted from the pool instead of being returned for reuse.
This includes timeouts, cancellations, and errors.
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 (const: unstable) · 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> Extension for LruDropPool<C, ID>
§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>, Box<dyn Error + Send + Sync>>
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>, Box<dyn Error + Send + Sync>>
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> !RefUnwindSafe for LruDropPool<C, ID>
impl<C, ID> !UnwindSafe for LruDropPool<C, ID>
impl<C, ID> Freeze 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> UnsafeUnpin for LruDropPool<C, ID>where
Arc<Mutex<RawMutex, VecDeque<PooledConnection<C, ID>>>>: UnsafeUnpin,
ConnReturner<C, ID>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§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