pub trait InstrumentablePool<'p> {
type Resource: 'p;
type Error: Error + Send + 'static;
// Required method
fn get<'async_trait>(
&'p self,
) -> Pin<Box<dyn Future<Output = Result<Self::Resource, Error<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'p: 'async_trait;
// Provided methods
fn try_get(&'p self) -> Result<Self::Resource, Error<Self::Error>> { ... }
fn get_timeout<'async_trait>(
&'p self,
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Self::Resource, Error<Self::Error>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'p: 'async_trait { ... }
fn get_state(&'p self) -> Result<PoolState, Error<Self::Error>> { ... }
}Expand description
Pool objects implementing this trait can be instrumented.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn try_get(&'p self) -> Result<Self::Resource, Error<Self::Error>>
fn try_get(&'p self) -> Result<Self::Resource, Error<Self::Error>>
Instantly acquire a resource from the pool.
§Errors
Returns Err if blocking is required, or if this operation is not implemented for this
pool type.
Sourcefn get_timeout<'async_trait>(
&'p self,
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Self::Resource, Error<Self::Error>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'p: 'async_trait,
fn get_timeout<'async_trait>(
&'p self,
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<Self::Resource, Error<Self::Error>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'p: 'async_trait,
Try to acquire a resource from the pool, waiting for a bounded time.
§Errors
Must return Error::AcquireTimeout if waiting time was exhaused.
Returns Error::NotImplemented if this operation is not implemented for this pool type.
Sourcefn get_state(&'p self) -> Result<PoolState, Error<Self::Error>>
fn get_state(&'p self) -> Result<PoolState, Error<Self::Error>>
Get various internal pool counts and metrics.
This is in turn used to update OpenTelemetry metrics.
§Errors
Returns Err if there was a problem collecting pool state, or Error::NotImplemented if
state collection is not implemented for this pool type.