FailoverPool

Struct FailoverPool 

Source
pub struct FailoverPool<F, P>(/* private fields */)
where
    F: ClientFacts,
    P: ClientTransport;
Expand description

A pool supports failover to multiple address with optional 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.

NOTE: there’s cycle reference inside FailoverPoolInner and it’s ClientPool, don’t clone FailoverPool as it has custom drop. FailoverPool should be put in Arc for usage.

Implementations§

Source§

impl<F, P> FailoverPool<F, P>

Source

pub fn new( facts: Arc<F>, addrs: Vec<String>, round_robin: bool, retry_limit: usize, pool_channel_size: usize, ) -> Self

Source

pub fn update_addrs(&self, addrs: Vec<String>)

Trait Implementations§

Source§

impl<F, P> ClientCaller for FailoverPool<F, P>

Source§

type Facts = F

Source§

async fn send_req(&self, task: F::Task)

Source§

impl<F, P> ClientCallerBlocking for FailoverPool<F, P>

Source§

type Facts = F

Source§

fn send_req_blocking(&self, task: F::Task)

Source§

impl<F, P> Drop for FailoverPool<F, P>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> !UnwindSafe for FailoverPool<F, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V