pub trait PartitionAssigner: Send + Sync {
// Required methods
fn initial_assignment(
&self,
num_partitions: u32,
nodes: &[NodeInfo],
constraints: &AssignmentConstraints,
) -> AssignmentPlan;
fn rebalance(
&self,
current: &HashMap<u32, NodeId>,
nodes: &[NodeInfo],
constraints: &AssignmentConstraints,
) -> AssignmentPlan;
fn validate_plan(
&self,
plan: &AssignmentPlan,
nodes: &[NodeInfo],
constraints: &AssignmentConstraints,
) -> Vec<String>;
}Expand description
Trait for partition assignment algorithms.
Required Methods§
Sourcefn initial_assignment(
&self,
num_partitions: u32,
nodes: &[NodeInfo],
constraints: &AssignmentConstraints,
) -> AssignmentPlan
fn initial_assignment( &self, num_partitions: u32, nodes: &[NodeInfo], constraints: &AssignmentConstraints, ) -> AssignmentPlan
Generate an initial assignment for the given number of partitions.
Sourcefn rebalance(
&self,
current: &HashMap<u32, NodeId>,
nodes: &[NodeInfo],
constraints: &AssignmentConstraints,
) -> AssignmentPlan
fn rebalance( &self, current: &HashMap<u32, NodeId>, nodes: &[NodeInfo], constraints: &AssignmentConstraints, ) -> AssignmentPlan
Generate a rebalance plan given the current assignments and new node set.
Sourcefn validate_plan(
&self,
plan: &AssignmentPlan,
nodes: &[NodeInfo],
constraints: &AssignmentConstraints,
) -> Vec<String>
fn validate_plan( &self, plan: &AssignmentPlan, nodes: &[NodeInfo], constraints: &AssignmentConstraints, ) -> Vec<String>
Validate that an assignment plan satisfies the given constraints.