pub struct ManagedChannelPool { /* private fields */ }Expand description
Self-managed pool of tonic’s Channels.
Implementations§
Source§impl ManagedChannelPool
impl ManagedChannelPool
Sourcepub fn endpoint(&self) -> &EndpointTemplate
pub fn endpoint(&self) -> &EndpointTemplate
Returns a reference to the endpoint template used by the pool.
Trait Implementations§
Source§impl ChannelPool for ManagedChannelPool
impl ChannelPool for ManagedChannelPool
Source§fn get_channel<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<(IpAddr, Channel)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_channel<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<(IpAddr, Channel)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a channel from the pool.
This function will return a channel if one is available, or None if no
channels are available.
§Selection algorithm
Currently, the channel is selected randomly from the pool of available channels. However, this behavior may change in the future.
§Additional DNS and broken connection checks
If no channels are available, the function will check the DNS and recheck connections to all servers currently marked as dead. To avoid spamming the DNS and other servers, this will be performed no more than once every 500ms.
If the above check is running while this function is called, the function will wait for the check to finish and return the result.
If the check is not running, but the last check was performed less than 500ms ago,
the function will return None immediately.
The specifics of this behavior are not set in stone and may change in the future.
Source§fn report_broken<'life0, 'async_trait>(
&'life0 self,
ip_address: IpAddr,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn report_broken<'life0, 'async_trait>(
&'life0 self,
ip_address: IpAddr,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Report a broken endpoint to the pool.
This function will remove the endpoint from the pool and add it to the list of currently dead servers.
Source§impl Clone for ManagedChannelPool
This is a shallow clone, meaning that the new pool will reference the same
resources as the original pool.
impl Clone for ManagedChannelPool
This is a shallow clone, meaning that the new pool will reference the same resources as the original pool.
Auto Trait Implementations§
impl Freeze for ManagedChannelPool
impl !RefUnwindSafe for ManagedChannelPool
impl Send for ManagedChannelPool
impl Sync for ManagedChannelPool
impl Unpin for ManagedChannelPool
impl !UnwindSafe for ManagedChannelPool
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request