Struct scylla::transport::load_balancing::DefaultPolicy
source · pub struct DefaultPolicy { /* private fields */ }
Expand description
The default load balancing policy.
It can be configured to be datacenter-aware, rack-aware and token-aware. Datacenter failover (sending query to a node from a remote datacenter) for queries with non local consistency mode is also supported.
Latency awareness is available, although not recommended: the penalisation mechanism it involves may interact badly with other mechanisms, such as LWT optimisation. Also, the very tactics of penalising nodes for recently measures latencies is believed to not be very stable and beneficial. The number of in-flight requests, for instance, seems to be a better metric showing how (over)loaded a target node/shard is. For now, however, we don’t have an implementation of the in-flight-requests-aware policy.
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>, Option<Shard>)>
fn pick<'a>( &'a self, query: &'a RoutingInfo<'_>, cluster: &'a ClusterData, ) -> Option<(NodeRef<'a>, Option<Shard>)>
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>
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<'_>, )
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, )
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
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>
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>
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