public class

ClusterAccessor

extends Object
java.lang.Object
   ↳ org.apache.helix.api.accessor.ClusterAccessor
Known Direct Subclasses

Summary

Public Constructors
ClusterAccessor(ClusterId clusterId, HelixDataAccessor accessor)
Instantiate a cluster accessor
Public Methods
boolean addAlert(String alertName)
Add an alert specification to the cluster
boolean addParticipantToCluster(ParticipantConfig participant)
add a participant to cluster
boolean addResourceToCluster(ResourceConfig resource)
add a resource to cluster
boolean addStat(String statName)
Add a statistic specification to the cluster.
boolean addStateModelDefinitionToCluster(StateModelDefinition stateModelDef)
Add a state model definition.
boolean createCluster(ClusterConfig cluster)
create a new cluster, fail if it already exists
boolean dropAlert(String alertName)
Remove an alert specification from the cluster
boolean dropCluster()
drop a cluster
boolean dropParticipantFromCluster(ParticipantId participantId)
drop a participant from cluster
boolean dropResourceFromCluster(ResourceId resourceId)
drop a resource from cluster
boolean dropStat(String statName)
Remove a statistic specification from the cluster
boolean dropStateModelDefinitionFromCluster(StateModelDefId stateModelDefId)
Remove a state model definition if it exists
boolean dropUserConfig()
Clear any user-specified configuration from the cluster
void initClusterStructure()
Create empty persistent properties to ensure that there is a valid cluster structure
boolean isClusterStructureValid()
check if cluster structure is valid
boolean pauseCluster()
pause controller of cluster
Cluster readCluster()
read entire cluster data
ClusterConstraints readConstraints(ClusterConstraints.ConstraintType type)
Get cluster constraints of a given type
Map<ParticipantIdParticipant> readParticipants()
Read all participants in the cluster
Map<ResourceIdResource> readResources()
Read all resources in the cluster
Map<StateModelDefIdStateModelDefinition> readStateModelDefinitions()
Get all the state model definitions for this cluster
PersistentStats readStats()
Get the stats persisted on this cluster
UserConfig readUserConfig()
Read the user config of the cluster
boolean removeConstraint(ClusterConstraints.ConstraintType type, ConstraintId constraintId)
Remove a constraint from the cluster
boolean resumeCluster()
resume controller of cluster
boolean setUserConfig(UserConfig userConfig)
Set the user config of the cluster, overwriting existing user configs
ClusterConfig updateCluster(ClusterConfig.Delta clusterDelta)
Update the cluster configuration
boolean updateUserConfig(UserConfig userConfig)
Add user configuration to the existing cluster user configuration.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ClusterAccessor (ClusterId clusterId, HelixDataAccessor accessor)

Instantiate a cluster accessor

Parameters
clusterId the cluster to access
accessor HelixDataAccessor for the physical store

Public Methods

public boolean addAlert (String alertName)

Add an alert specification to the cluster

Parameters
alertName string representing the alert spec
Returns
  • true if added, false otherwise

public boolean addParticipantToCluster (ParticipantConfig participant)

add a participant to cluster

Returns
  • true if participant added, false otherwise

public boolean addResourceToCluster (ResourceConfig resource)

add a resource to cluster

Returns
  • true if resource added, false if there was an error

public boolean addStat (String statName)

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

Parameters
statName string representing a stat specification
Returns
  • true if the stat spec was added, false otherwise

public boolean addStateModelDefinitionToCluster (StateModelDefinition stateModelDef)

Add a state model definition. Updates the existing state model definition if it already exists.

Parameters
stateModelDef fully initialized state model definition
Returns
  • true if the model is persisted, false otherwise

public boolean createCluster (ClusterConfig cluster)

create a new cluster, fail if it already exists

Returns
  • true if created, false if creation failed

public boolean dropAlert (String alertName)

Remove an alert specification from the cluster

Parameters
alertName string representing an alert specification
Returns
  • true if removed, false otherwise

public boolean dropCluster ()

drop a cluster

Returns
  • true if the cluster was dropped, false if there was an error

public boolean dropParticipantFromCluster (ParticipantId participantId)

drop a participant from cluster

Returns
  • true if participant dropped, false if there was an error

public boolean dropResourceFromCluster (ResourceId resourceId)

drop a resource from cluster

Returns
  • true if removal succeeded, false otherwise

public boolean dropStat (String statName)

Remove a statistic specification from the cluster

Parameters
statName string representing a statistic specification
Returns
  • true if stats removed, false otherwise

public boolean dropStateModelDefinitionFromCluster (StateModelDefId stateModelDefId)

Remove a state model definition if it exists

Parameters
stateModelDefId state model definition id
Returns
  • true if removed, false if it did not exist

public boolean dropUserConfig ()

Clear any user-specified configuration from the cluster

Returns
  • true if the config was cleared, false otherwise

public void initClusterStructure ()

Create empty persistent properties to ensure that there is a valid cluster structure

public boolean isClusterStructureValid ()

check if cluster structure is valid

Returns
  • true if valid or false otherwise

public boolean pauseCluster ()

pause controller of cluster

Returns
  • true if cluster was paused, false if pause failed or already paused

public Cluster readCluster ()

read entire cluster data

Returns
  • cluster snapshot or null

public ClusterConstraints readConstraints (ClusterConstraints.ConstraintType type)

Get cluster constraints of a given type

Parameters
type ConstraintType value
Returns
  • ClusterConstraints, or null if none present

public Map<ParticipantIdParticipant> readParticipants ()

Read all participants in the cluster

Returns
  • map of participant id to participant, or empty map

public Map<ResourceIdResource> readResources ()

Read all resources in the cluster

Returns
  • map of resource id to resource

public Map<StateModelDefIdStateModelDefinition> readStateModelDefinitions ()

Get all the state model definitions for this cluster

Returns
  • map of state model def id to state model definition

public PersistentStats readStats ()

Get the stats persisted on this cluster

Returns
  • PersistentStats, or null if none persisted

public UserConfig readUserConfig ()

Read the user config of the cluster

Returns
  • UserConfig, or null

public boolean removeConstraint (ClusterConstraints.ConstraintType type, ConstraintId constraintId)

Remove a constraint from the cluster

Parameters
type the constraint type
constraintId the constraint id
Returns
  • true if removed, false otherwise

public boolean resumeCluster ()

resume controller of cluster

Returns
  • true if resume succeeded, false otherwise

public boolean setUserConfig (UserConfig userConfig)

Set the user config of the cluster, overwriting existing user configs

Parameters
userConfig the new user config
Returns
  • true if the user config was set, false otherwise

public ClusterConfig updateCluster (ClusterConfig.Delta clusterDelta)

Update the cluster configuration

Parameters
clusterDelta change to the cluster configuration
Returns
  • updated ClusterConfig, or null if there was an error

public boolean updateUserConfig (UserConfig userConfig)

Add user configuration to the existing cluster user configuration. Overwrites properties with the same key

Parameters
userConfig the user config key-value pairs to add
Returns
  • true if the user config was updated, false otherwise