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, Map<ContextIdControllerContext> contextMap, UserConfig userConfig, boolean isPaused, boolean autoJoinAllowed, ClusterDataCache cache)
construct a cluster
Public Methods
boolean autoJoinAllowed()
Check if the cluster supports participants automatically joining
ClusterDataCache getCache()
Get a ClusterDataCache object which is a flattened version of the physical properties read to build this object.
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<ContextIdControllerContext> getContextMap()
Get all the controller context currently 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
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, Map<ContextIdControllerContext> contextMap, UserConfig userConfig, boolean isPaused, boolean autoJoinAllowed, ClusterDataCache cache)

construct a cluster

Public Methods

public boolean autoJoinAllowed ()

Check if the cluster supports participants automatically joining

Returns
  • true if allowed, false if disallowed

public ClusterDataCache getCache ()

Get a ClusterDataCache object which is a flattened version of the physical properties read to build this object.

Returns
  • ClusterDataCache

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<ContextIdControllerContext> getContextMap ()

Get all the controller context currently on the cluster

Returns
  • map of context id to controller context objects

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 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