public abstract class AbstractGoal extends Object implements Goal
Constructor and Description |
---|
AbstractGoal()
Constructor of Abstract Goal class sets the _finished flag to false to signal that the goal requirements have not
been satisfied, yet.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(Map<String,?> configs)
Configure this class with the given key-value pairs
|
abstract String |
name()
Get the name of this goal.
|
GoalOptimizationResult |
optimize(ClusterModel clusterModel,
Set<Goal> optimizedGoals,
OptimizationOptions optimizationOptions,
Optional<OptimizationMetrics> optimizationMetricsOpt)
The entry-point to a goal, this method mutates the given #
ClusterModel object by optimizing it
in accordance to the goal |
boolean |
selfSatisfied(ClusterModel clusterModel,
BalancingAction action)
Check if requirements of this goal are not violated if this action is applied to the given cluster state,
false otherwise.
|
String |
toString() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
actionAcceptance, canChangeReplicationFactor, clusterModelCompletenessRequirements, clusterModelStatsComparator, finish, isHardGoal, optimize
partitionActionAcceptance, partitionActionSelfSatisfied, replicaActionAcceptance, replicaActionSelfSatisfied
public AbstractGoal()
public void configure(Map<String,?> configs)
CruiseControlConfigurable
configure
in interface CruiseControlConfigurable
public GoalOptimizationResult optimize(ClusterModel clusterModel, Set<Goal> optimizedGoals, OptimizationOptions optimizationOptions, Optional<OptimizationMetrics> optimizationMetricsOpt) throws OptimizationFailureException
ClusterModel
object by optimizing it
in accordance to the goaloptimize
in interface Goal
clusterModel
- The cluster model reflecting the current state of the cluster. It is a result of the
optimization of the previously optimized goals.optimizedGoals
- Goals that have already been optimized. These goals cannot be violated.optimizationOptions
- Options to take into account during optimization -- e.g. excluded topics.optimizationMetricsOpt
- An optional of a metrics object used to track various metrics related to this goal's optimization run.GoalOptimizationResult
denoting whether the goal was met after the optimization and whether any replica movements were made.
Note that for hard goals, the implementation should just throw exceptions if the goal is not met.OptimizationFailureException
- if the goal is a hard goal and it failed to optimize the given cluster modelpublic abstract String name()
Goal
public final boolean selfSatisfied(ClusterModel clusterModel, BalancingAction action)
clusterModel
- The state of the cluster.action
- Action containing information about potential modification to the given cluster model.