pub struct ConnectionPool { /* private fields */ }Expand description
ConnectionPool represents pool of connections to DAPI nodes.
It can be cloned and shared between threads. Cloning the pool will create a new reference to the same pool.
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
Sourcepub fn get(
&self,
prefix: PoolPrefix,
uri: &Uri,
settings: Option<&AppliedRequestSettings>,
) -> Option<PoolItem>
pub fn get( &self, prefix: PoolPrefix, uri: &Uri, settings: Option<&AppliedRequestSettings>, ) -> Option<PoolItem>
Get item from the pool for the given uri and settings.
§Arguments
prefix- Prefix for the item in the pool. Used to distinguish between Core and Platform clients.uri- URI of the node.settings- Applied request settings.
Sourcepub fn get_or_create<E>(
&self,
prefix: PoolPrefix,
uri: &Uri,
settings: Option<&AppliedRequestSettings>,
create: impl FnOnce() -> Result<PoolItem, E>,
) -> Result<PoolItem, E>
pub fn get_or_create<E>( &self, prefix: PoolPrefix, uri: &Uri, settings: Option<&AppliedRequestSettings>, create: impl FnOnce() -> Result<PoolItem, E>, ) -> Result<PoolItem, E>
Get value from cache or create it using provided closure.
If value is already in the cache, it will be returned.
If value is not in the cache, it will be created by calling create() and stored in the cache.
§Arguments
prefix- Prefix for the item in the pool. Used to distinguish between Core and Platform clients.uri- URI of the node.settings- Applied request settings.
Sourcepub fn put(
&self,
uri: &Uri,
settings: Option<&AppliedRequestSettings>,
value: PoolItem,
)
pub fn put( &self, uri: &Uri, settings: Option<&AppliedRequestSettings>, value: PoolItem, )
Put item into the pool for the given uri and settings.
Trait Implementations§
Source§impl Clone for ConnectionPool
impl Clone for ConnectionPool
Source§fn clone(&self) -> ConnectionPool
fn clone(&self) -> ConnectionPool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionPool
impl Debug for ConnectionPool
Auto Trait Implementations§
impl Freeze for ConnectionPool
impl RefUnwindSafe for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl UnwindSafe for ConnectionPool
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
Source§fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
Performs the conversion.
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].Source§impl<T, U> TryIntoPlatformVersioned<U> for Twhere
U: TryFromPlatformVersioned<T>,
impl<T, U> TryIntoPlatformVersioned<U> for Twhere
U: TryFromPlatformVersioned<T>,
Source§type Error = <U as TryFromPlatformVersioned<T>>::Error
type Error = <U as TryFromPlatformVersioned<T>>::Error
The type returned in the event of a conversion error.
Source§fn try_into_platform_versioned(
self,
platform_version: &PlatformVersion,
) -> Result<U, <U as TryFromPlatformVersioned<T>>::Error>
fn try_into_platform_versioned( self, platform_version: &PlatformVersion, ) -> Result<U, <U as TryFromPlatformVersioned<T>>::Error>
Performs the conversion.
§impl<T, U> TryIntoVersioned<U> for Twhere
U: TryFromVersioned<T>,
impl<T, U> TryIntoVersioned<U> for Twhere
U: TryFromVersioned<T>,
§type Error = <U as TryFromVersioned<T>>::Error
type Error = <U as TryFromVersioned<T>>::Error
The type returned in the event of a conversion error.
§fn try_into_versioned(
self,
grove_version: &GroveVersion,
) -> Result<U, <U as TryFromVersioned<T>>::Error>
fn try_into_versioned( self, grove_version: &GroveVersion, ) -> Result<U, <U as TryFromVersioned<T>>::Error>
Performs the conversion.