pub struct DefaultPolicy { /* private fields */ }
Expand description
The default load balancing policy.
It can be configured to be datacenter-aware and token-aware. Datacenter failover for queries with non local consistency mode is also supported. Latency awareness is available, althrough not recommended.
Implementations§
Source§impl DefaultPolicy
impl DefaultPolicy
Sourcepub fn builder() -> DefaultPolicyBuilder
pub fn builder() -> DefaultPolicyBuilder
Creates a builder used to customise configuration of a new DefaultPolicy.
Trait Implementations§
Source§impl Debug for DefaultPolicy
impl Debug for DefaultPolicy
Source§impl Default for DefaultPolicy
impl Default for DefaultPolicy
Source§impl LoadBalancingPolicy for DefaultPolicy
impl LoadBalancingPolicy for DefaultPolicy
Source§fn pick<'a>(
&'a self,
query: &'a RoutingInfo<'_>,
cluster: &'a ClusterData,
) -> Option<NodeRef<'a>>
fn pick<'a>( &'a self, query: &'a RoutingInfo<'_>, cluster: &'a ClusterData, ) -> Option<NodeRef<'a>>
Returns the first node to contact for a given query.
Source§fn fallback<'a>(
&'a self,
query: &'a RoutingInfo<'_>,
cluster: &'a ClusterData,
) -> FallbackPlan<'a>
fn fallback<'a>( &'a self, query: &'a RoutingInfo<'_>, cluster: &'a ClusterData, ) -> FallbackPlan<'a>
Returns all contact-appropriate nodes for a given query.
Source§fn on_query_success(
&self,
_routing_info: &RoutingInfo<'_>,
latency: Duration,
node: NodeRef<'_>,
)
fn on_query_success( &self, _routing_info: &RoutingInfo<'_>, latency: Duration, node: NodeRef<'_>, )
Invoked each time a query succeeds.
Source§fn on_query_failure(
&self,
_routing_info: &RoutingInfo<'_>,
latency: Duration,
node: NodeRef<'_>,
error: &QueryError,
)
fn on_query_failure( &self, _routing_info: &RoutingInfo<'_>, latency: Duration, node: NodeRef<'_>, error: &QueryError, )
Invoked each time a query fails.
Auto Trait Implementations§
impl Freeze for DefaultPolicy
impl !RefUnwindSafe for DefaultPolicy
impl Send for DefaultPolicy
impl Sync for DefaultPolicy
impl Unpin for DefaultPolicy
impl !UnwindSafe for DefaultPolicy
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more