public static class

ClusterConfig.Builder

extends Object
java.lang.Object
   ↳ org.apache.helix.api.config.ClusterConfig.Builder

Class Overview

Assembles a cluster configuration

Summary

Public Constructors
ClusterConfig.Builder(ClusterId id)
Initialize builder for a cluster
Public Methods
ClusterConfig.Builder addAlert(String alert)
Add alert specifications to the cluster.
ClusterConfig.Builder addAlerts(Alerts alerts)
Add alert specifications to the cluster.
ClusterConfig.Builder addConstraint(ClusterConstraints constraint)
Add a constraint to the cluster
ClusterConfig.Builder addConstraint(ClusterConstraints.ConstraintType type, ConstraintId constraintId, ConstraintItem item)
Add a single constraint item
ClusterConfig.Builder addConstraints(Collection<ClusterConstraints> constraints)
Add multiple constraints to the cluster
ClusterConfig.Builder addParticipant(ParticipantConfig participant)
Add a participant to the cluster
ClusterConfig.Builder addParticipants(Collection<ParticipantConfig> participants)
Add multiple participants to the cluster
ClusterConfig.Builder addResource(ResourceConfig resource)
Add a resource to the cluster
ClusterConfig.Builder addResources(Collection<ResourceConfig> resources)
Add multiple resources to the cluster
ClusterConfig.Builder addStat(String stat)
Add a statistic specification to the cluster.
ClusterConfig.Builder addStateModelDefinition(StateModelDefinition stateModelDef)
Add a state model definition to the cluster
ClusterConfig.Builder addStateModelDefinitions(Collection<StateModelDefinition> stateModelDefs)
Add multiple state model definitions
ClusterConfig.Builder addStateUpperBoundConstraint(Scope<?> scope, StateModelDefId stateModelDefId, State state, String dynamicUpperBound)
Add a state upper bound constraint
ClusterConfig.Builder addStateUpperBoundConstraint(Scope<?> scope, StateModelDefId stateModelDefId, State state, int upperBound)
Add a state upper bound constraint
ClusterConfig.Builder addStats(PersistentStats stats)
Add statistic specifications to the cluster.
ClusterConfig.Builder addTransitionConstraint(Scope<?> scope, StateModelDefId stateModelDefId, Transition transition, int maxInFlightTransitions)
Add a constraint on the maximum number of in-flight transitions of a certain type
ClusterConfig.Builder autoJoin(boolean autoJoin)
Allow or disallow participants from automatically being able to join the cluster
ClusterConfig build()
Create the cluster configuration
ClusterConfig.Builder pausedStatus(boolean isPaused)
Set the paused status of the cluster
ClusterConfig.Builder userConfig(UserConfig userConfig)
Set the user configuration
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ClusterConfig.Builder (ClusterId id)

Initialize builder for a cluster

Parameters
id cluster id

Public Methods

public ClusterConfig.Builder addAlert (String alert)

Add alert specifications to the cluster. Existing specifications will not be overwritten

Parameters
alert string representing alert specifications
Returns
  • Builder

public ClusterConfig.Builder addAlerts (Alerts alerts)

Add alert specifications to the cluster. Existing specifications will not be overwritten

Parameters
alerts Alerts instance
Returns
  • Builder

public ClusterConfig.Builder addConstraint (ClusterConstraints constraint)

Add a constraint to the cluster

Parameters
constraint cluster constraint of a specific type
Returns
  • Builder

public ClusterConfig.Builder addConstraint (ClusterConstraints.ConstraintType type, ConstraintId constraintId, ConstraintItem item)

Add a single constraint item

Parameters
type type of the constraint
constraintId unique constraint identifier
item instantiated ConstraintItem
Returns
  • Builder

public ClusterConfig.Builder addConstraints (Collection<ClusterConstraints> constraints)

Add multiple constraints to the cluster

Parameters
constraints cluster constraints of multiple distinct types
Returns
  • Builder

public ClusterConfig.Builder addParticipant (ParticipantConfig participant)

Add a participant to the cluster

Parameters
participant participant configuration
Returns
  • Builder

public ClusterConfig.Builder addParticipants (Collection<ParticipantConfig> participants)

Add multiple participants to the cluster

Parameters
participants participant configurations
Returns
  • Builder

public ClusterConfig.Builder addResource (ResourceConfig resource)

Add a resource to the cluster

Parameters
resource resource configuration
Returns
  • Builder

public ClusterConfig.Builder addResources (Collection<ResourceConfig> resources)

Add multiple resources to the cluster

Parameters
resources resource configurations
Returns
  • Builder

public ClusterConfig.Builder addStat (String stat)

Add a statistic specification to the cluster. Existing specifications will not be overwritten

Parameters
stat String specifying the stat specification
Returns
  • Builder

public ClusterConfig.Builder addStateModelDefinition (StateModelDefinition stateModelDef)

Add a state model definition to the cluster

Parameters
stateModelDef state model definition of the cluster
Returns
  • Builder

public ClusterConfig.Builder addStateModelDefinitions (Collection<StateModelDefinition> stateModelDefs)

Add multiple state model definitions

Parameters
stateModelDefs collection of state model definitions for the cluster
Returns
  • Builder

public ClusterConfig.Builder addStateUpperBoundConstraint (Scope<?> scope, StateModelDefId stateModelDefId, State state, String dynamicUpperBound)

Add a state upper bound constraint

Parameters
scope scope under which the constraint is valid
stateModelDefId identifier of the state model that owns the state
state the state to constrain
dynamicUpperBound the upper bound of replicas per partition in the state, can be a number, or the currently supported special bound values:
"R" - Refers to the number of replicas specified during resource creation. This allows having different replication factor for each resource without having to create a different state machine.
"N" - Refers to all nodes in the cluster. Useful for resources that need to exist on all nodes. This way one can add/remove nodes without having the change the bounds.
Returns
  • Builder

public ClusterConfig.Builder addStateUpperBoundConstraint (Scope<?> scope, StateModelDefId stateModelDefId, State state, int upperBound)

Add a state upper bound constraint

Parameters
scope scope under which the constraint is valid
stateModelDefId identifier of the state model that owns the state
state the state to constrain
upperBound maximum number of replicas per partition in the state
Returns
  • Builder

public ClusterConfig.Builder addStats (PersistentStats stats)

Add statistic specifications to the cluster. Existing specifications will not be overwritten

Parameters
stats PersistentStats specifying the stat specification
Returns
  • Builder

public ClusterConfig.Builder addTransitionConstraint (Scope<?> scope, StateModelDefId stateModelDefId, Transition transition, int maxInFlightTransitions)

Add a constraint on the maximum number of in-flight transitions of a certain type

Parameters
scope scope of the constraint
stateModelDefId identifies the state model containing the transition
transition the transition to constrain
maxInFlightTransitions number of allowed in-flight transitions in the scope
Returns
  • Builder

public ClusterConfig.Builder autoJoin (boolean autoJoin)

Allow or disallow participants from automatically being able to join the cluster

Parameters
autoJoin true if allowed, false if disallowed
Returns
  • Builder

public ClusterConfig build ()

Create the cluster configuration

Returns
  • ClusterConfig

public ClusterConfig.Builder pausedStatus (boolean isPaused)

Set the paused status of the cluster

Parameters
isPaused true if paused, false otherwise
Returns
  • Builder

public ClusterConfig.Builder userConfig (UserConfig userConfig)

Set the user configuration

Parameters
userConfig user-specified properties
Returns
  • Builder