Skip to content

Commit

Permalink
less qualifying more use
Browse files Browse the repository at this point in the history
  • Loading branch information
Ten0 committed Jul 3, 2023
1 parent bab56d3 commit 84ee6aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 5 additions & 6 deletions scylla/src/statement/batch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::Arc;

use crate::history::HistoryListener;
use crate::load_balancing;
use crate::retry_policy::RetryPolicy;
use crate::statement::{prepared_statement::PreparedStatement, query::Query};
use crate::transport::{execution_profile::ExecutionProfileHandle, Node};
Expand Down Expand Up @@ -211,12 +212,10 @@ impl Batch {
self.set_execution_profile_handle(Some(
execution_profile_handle
.pointee_to_builder()
.load_balancing_policy(Arc::new(
crate::load_balancing::EnforceTargetNodePolicy::new(
node,
execution_profile_handle.load_balancing_policy(),
),
))
.load_balancing_policy(Arc::new(load_balancing::EnforceTargetNodePolicy::new(
node,
execution_profile_handle.load_balancing_policy(),
)))
.build()
.into_handle(),
))
Expand Down
3 changes: 2 additions & 1 deletion scylla/src/transport/load_balancing/enforce_node.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use super::{DefaultPolicy, FallbackPlan, LoadBalancingPolicy, NodeRef, RoutingInfo};
use crate::transport::{cluster::ClusterData, Node};
use std::sync::Arc;
use uuid::Uuid;

/// This policy will always return the same node, unless it is not available anymore, in which case it will
/// fallback to the provided policy.
///
/// This is meant to be used for shard-aware batching.
#[derive(Debug)]
pub struct EnforceTargetNodePolicy {
target_node: uuid::Uuid,
target_node: Uuid,
fallback: Arc<dyn LoadBalancingPolicy>,
}

Expand Down

0 comments on commit 84ee6aa

Please sign in to comment.