pub struct FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,{ /* private fields */ }Expand description
A pool supports failover to multiple address with bias or round_robin strategy
Supports async and blocking context.
Only retry RpcIntErr that less than RpcIntErr::Method, currently ignore custom error due to complexity of generic. (If you need to custom failover logic, copy the code and impl your own pool.)
Implementations§
Source§impl<F, P> FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
impl<F, P> FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
Sourcepub fn new<RT: AsyncRuntime + Clone>(
facts: Arc<F>,
rt: &RT,
addrs: Vec<String>,
round_robin: bool,
retry_limit: usize,
pool_channel_size: usize,
) -> Self
pub fn new<RT: AsyncRuntime + Clone>( facts: Arc<F>, rt: &RT, addrs: Vec<String>, round_robin: bool, retry_limit: usize, pool_channel_size: usize, ) -> Self
Initiate the pool with multiple address. When round_robin == true, all address in the pool will be select with equal chanced; When round_robin == false, the first address will always be pick unless error happens.
pub fn update_addrs<RT: AsyncRuntime + Clone>( &self, addrs: Vec<String>, rt: &RT, )
Trait Implementations§
Source§impl<F, P> ClientCaller for FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
impl<F, P> ClientCaller for FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
Source§impl<F, P> ClientCallerBlocking for FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
impl<F, P> ClientCallerBlocking for FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
Source§impl<F, P> Clone for FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
impl<F, P> Clone for FailoverPool<F, P>where
F: ClientFacts,
P: ClientTransport,
Auto Trait Implementations§
impl<F, P> Freeze for FailoverPool<F, P>
impl<F, P> !RefUnwindSafe for FailoverPool<F, P>
impl<F, P> Send for FailoverPool<F, P>
impl<F, P> Sync for FailoverPool<F, P>
impl<F, P> Unpin for FailoverPool<F, P>
impl<F, P> UnsafeUnpin for FailoverPool<F, P>
impl<F, P> !UnwindSafe for FailoverPool<F, P>
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