ChannelPool

Trait ChannelPool 

Source
pub trait ChannelPool {
    // Required methods
    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 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;
}
Expand description

Trait implemented by channel pools.

Note: The trait definition is using async_trait so it is possible (or even suggested) for implementations to do the same.

Required Methods§

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,

Get a channel from the pool.

Returns a channel if one is available, or None if no channels are available.

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,

Report a broken endpoint to the pool.

Removes the endpoint from the pool and add it to the list of currently dead servers.

Implementors§

Source§

impl ChannelPool for MockChannelPool

Available on crate feature mock only.
Source§

impl ChannelPool for ManagedChannelPool