public class

PartitionedRebalancerContext

extends BasicRebalancerContext
implements ReplicatedRebalancerContext
java.lang.Object
   ↳ org.apache.helix.controller.rebalancer.context.BasicRebalancerContext
     ↳ org.apache.helix.controller.rebalancer.context.PartitionedRebalancerContext
Known Direct Subclasses

Class Overview

RebalancerContext for a resource whose subunits are partitions. In addition, these partitions can be replicated.

Summary

Nested Classes
class PartitionedRebalancerContext.AbstractBuilder<T extends AbstractBuilder<T>> Abstract builder for a generic partitioned resource rebalancer context  
class PartitionedRebalancerContext.Builder Builder for a basic data rebalancer context  
Public Constructors
PartitionedRebalancerContext()
Instantiate a DataRebalancerContext
Public Methods
boolean anyLiveParticipant()
Check if this resource should be assigned to any live participant
static PartitionedRebalancerContext from(IdealState idealState)
Convert a physically-stored IdealState into a rebalancer context for a partitioned resource
void generateDefaultConfiguration(StateModelDefinition stateModelDef, Set<ParticipantId> participantSet)
Generate a default configuration given the state model and a participant.
int getMaxPartitionsPerParticipant()
Get the maximum number of partitions that a participant can serve
Partition getPartition(PartitionId partitionId)
Get a partition
Map<PartitionIdPartition> getPartitionMap()
Get a map from partition id to partition
Set<PartitionId> getPartitionSet()
Get the set of partitions for this resource
IdealState.RebalanceMode getRebalanceMode()
Get the rebalancer mode of the resource
int getReplicaCount()
Get the number of replicas that each resource subunit should have
Map<PartitionIdPartition> getSubUnitMap()
Get a map of resource partition identifiers to partitions.
void setAnyLiveParticipant(boolean anyLiveParticipant)
Indicate if this resource should be assigned to any live participant
void setMaxPartitionsPerParticipant(int maxPartitionsPerParticipant)
Set the maximum number of partitions that a participant can serve
void setPartitionMap(Map<PartitionIdPartition> partitionMap)
Set a map of partition id to partition
void setRebalanceMode(IdealState.RebalanceMode rebalanceMode)
Set the rebalancer mode of the partitioned resource
void setReplicaCount(int replicaCount)
Set the number of replicas that each partition should have
[Expand]
Inherited Methods
From class org.apache.helix.controller.rebalancer.context.BasicRebalancerContext
From class java.lang.Object
From interface org.apache.helix.controller.rebalancer.context.RebalancerContext
From interface org.apache.helix.controller.rebalancer.context.ReplicatedRebalancerContext

Public Constructors

public PartitionedRebalancerContext ()

Instantiate a DataRebalancerContext

Public Methods

public boolean anyLiveParticipant ()

Check if this resource should be assigned to any live participant

Returns
  • true if any live participant expected, false otherwise

public static PartitionedRebalancerContext from (IdealState idealState)

Convert a physically-stored IdealState into a rebalancer context for a partitioned resource

Parameters
idealState populated IdealState
Returns
  • PartitionedRebalancerContext

public void generateDefaultConfiguration (StateModelDefinition stateModelDef, Set<ParticipantId> participantSet)

Generate a default configuration given the state model and a participant.

Parameters
stateModelDef the state model definition to follow
participantSet the set of participant ids to configure for

public int getMaxPartitionsPerParticipant ()

Get the maximum number of partitions that a participant can serve

Returns
  • maximum number of partitions per participant

public Partition getPartition (PartitionId partitionId)

Get a partition

Parameters
partitionId id of the partition to get
Returns
  • Partition object, or null if not present

public Map<PartitionIdPartition> getPartitionMap ()

Get a map from partition id to partition

Returns
  • partition map (mutable)

public Set<PartitionId> getPartitionSet ()

Get the set of partitions for this resource

Returns
  • set of partition ids

public IdealState.RebalanceMode getRebalanceMode ()

Get the rebalancer mode of the resource

Returns
  • RebalanceMode

public int getReplicaCount ()

Get the number of replicas that each resource subunit should have

Returns
  • replica count

public Map<PartitionIdPartition> getSubUnitMap ()

Get a map of resource partition identifiers to partitions. A partition is a subunit of a resource, e.g. a subtask of a task

Returns
  • map of (subunit id, subunit) pairs

public void setAnyLiveParticipant (boolean anyLiveParticipant)

Indicate if this resource should be assigned to any live participant

Parameters
anyLiveParticipant true if any live participant expected, false otherwise

public void setMaxPartitionsPerParticipant (int maxPartitionsPerParticipant)

Set the maximum number of partitions that a participant can serve

Parameters
maxPartitionsPerParticipant maximum number of partitions per participant

public void setPartitionMap (Map<PartitionIdPartition> partitionMap)

Set a map of partition id to partition

Parameters
partitionMap partition map

public void setRebalanceMode (IdealState.RebalanceMode rebalanceMode)

Set the rebalancer mode of the partitioned resource

Parameters
rebalanceMode IdealState.RebalanceMode enum value

public void setReplicaCount (int replicaCount)

Set the number of replicas that each partition should have