Allows one to come up with custom implementation of a rebalancer.
This will be invoked on all changes that happen in the cluster.
Simply return the resource assignment for a resource in this method.
Given an ideal state for a resource and liveness of participants, compute a assignment of
instances and states to each partition of a resource. This method provides all the relevant
information needed to rebalance a resource. If you need additional information use
manager.getAccessor to read and write the cluster data. This allows one to compute the
ResourceAssignment according to app-specific requirements.
Say that you have:
class MyRebalancerConfig implements RebalancerConfig
as your rebalancer config. To get a typed version, you can do the following:
MyRebalancerConfig config = BasicRebalancerConfig.convert(rebalancerConfig,
||the ideal state that defines how a resource should be rebalanced
||the properties of the resource for which a mapping will be computed
||the previous ResourceAssignment of this cluster, or null if none
||complete snapshot of the cluster
||the current states of all partitions
Initialize the rebalancer with a HelixManager and ControllerContextProvider if necessary
||An object that supports getting and setting context across pipeline runs