public class

Cluster

extends Object
java.lang.Object
   ↳ org.apache.helix.api.Cluster

Class Overview

Represent a logical helix cluster

Summary

Public Constructors
Cluster(ClusterId id, Map<ResourceIdResource> resourceMap, Map<ParticipantIdParticipant> participantMap, Map<ControllerIdController> controllerMap, ControllerId leaderId, Map<ClusterConstraints.ConstraintTypeClusterConstraints> constraintMap, Map<StateModelDefIdStateModelDefinition> stateModelMap, PersistentStats stats, Alerts alerts, UserConfig userConfig, boolean isPaused, boolean autoJoinAllowed)
construct a cluster
Public Methods
boolean autoJoinAllowed()
Check if the cluster supports participants automatically joining
Alerts getAlerts()
Get all the persisted alerts for the cluster
ClusterConfig getConfig()
Get the ClusterConfig specifying this cluster
ClusterConstraints getConstraint(ClusterConstraints.ConstraintType type)
Get a cluster constraint
Map<ClusterConstraints.ConstraintTypeClusterConstraints> getConstraintMap()
Get all the constraints on the cluster
Map<ControllerIdController> getControllerMap()
Get controllers of the cluster
ClusterId getId()
Get cluster id
Controller getLeader()
Get the leader of the cluster
Map<ParticipantIdParticipant> getLiveParticipantMap()
Get live participants of the cluster
Map<ParticipantIdParticipant> getParticipantMap()
Get participants of the cluster
Resource getResource(ResourceId resourceId)
Get resource given resource id
Map<ResourceIdResource> getResourceMap()
Get resources in the cluster
Map<SpectatorIdSpectator> getSpectatorMap()
Get spectators of the cluster
Map<StateModelDefIdStateModelDefinition> getStateModelMap()
Get all the state model definitions on the cluster
String getStateUpperBoundConstraint(Scope<?> scope, StateModelDefId stateModelDefId, State state)
Get the maximum number of participants that can be in a state
PersistentStats getStats()
Get all the persisted stats for the cluster
int getTransitionConstraint(Scope<?> scope, StateModelDefId stateModelDefId, Transition transition)
Get the limit of simultaneous execution of a transition
UserConfig getUserConfig()
Get user-specified configuration properties of this cluster
boolean isPaused()
Check the paused status of the cluster
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Cluster (ClusterId id, Map<ResourceIdResource> resourceMap, Map<ParticipantIdParticipant> participantMap, Map<ControllerIdController> controllerMap, ControllerId leaderId, Map<ClusterConstraints.ConstraintTypeClusterConstraints> constraintMap, Map<StateModelDefIdStateModelDefinition> stateModelMap, PersistentStats stats, Alerts alerts, UserConfig userConfig, boolean isPaused, boolean autoJoinAllowed)

construct a cluster

Public Methods

public boolean autoJoinAllowed ()

Check if the cluster supports participants automatically joining

Returns
  • true if allowed, false if disallowed

public Alerts getAlerts ()

Get all the persisted alerts for the cluster

Returns
  • Alerts instance

public ClusterConfig getConfig ()

Get the ClusterConfig specifying this cluster

Returns
  • ClusterConfig

public ClusterConstraints getConstraint (ClusterConstraints.ConstraintType type)

Get a cluster constraint

Parameters
type the type of constrant to query
Returns
  • cluster constraints, or null if none

public Map<ClusterConstraints.ConstraintTypeClusterConstraints> getConstraintMap ()

Get all the constraints on the cluster

Returns
  • map of constraint type to constraints

public Map<ControllerIdController> getControllerMap ()

Get controllers of the cluster

Returns
  • a map of controller id to controller, or empty map if none

public ClusterId getId ()

Get cluster id

Returns
  • cluster id

public Controller getLeader ()

Get the leader of the cluster

Returns
  • the leader or null if not exist

public Map<ParticipantIdParticipant> getLiveParticipantMap ()

Get live participants of the cluster

Returns
  • a map of participant id to participant, or empty map if none is live

public Map<ParticipantIdParticipant> getParticipantMap ()

Get participants of the cluster

Returns
  • a map of participant id to participant, or empty map if none

public Resource getResource (ResourceId resourceId)

Get resource given resource id

Returns
  • resource or null if not exist

public Map<ResourceIdResource> getResourceMap ()

Get resources in the cluster

Returns
  • a map of resource id to resource, or empty map if none

public Map<SpectatorIdSpectator> getSpectatorMap ()

Get spectators of the cluster

Returns
  • a map of spectator id to spectator, or empty map if none

public Map<StateModelDefIdStateModelDefinition> getStateModelMap ()

Get all the state model definitions on the cluster

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

public String getStateUpperBoundConstraint (Scope<?> scope, StateModelDefId stateModelDefId, State state)

Get the maximum number of participants that can be in a state

Parameters
scope the scope for the bound
stateModelDefId the state model of the state
state the constrained state
Returns
  • The upper bound, which can be "-1" if unspecified, a numerical upper bound, "R" for number of replicas, or "N" for number of participants

public PersistentStats getStats ()

Get all the persisted stats for the cluster

Returns
  • PersistentStats instance

public int getTransitionConstraint (Scope<?> scope, StateModelDefId stateModelDefId, Transition transition)

Get the limit of simultaneous execution of a transition

Parameters
scope the scope under which the transition is constrained
stateModelDefId the state model of which the transition is a part
transition the constrained transition
Returns
  • the limit, or Integer.MAX_VALUE if there is no limit

public UserConfig getUserConfig ()

Get user-specified configuration properties of this cluster

Returns
  • UserConfig properties

public boolean isPaused ()

Check the paused status of the cluster

Returns
  • true if paused, false otherwise