public class

ClusterDataCache

extends Object
java.lang.Object
   ↳ org.apache.helix.controller.stages.ClusterDataCache

Class Overview

Reads the data from the cluster using data accessor. This output ClusterData which provides useful methods to search/lookup properties

Summary

Public Constructors
ClusterDataCache()
Public Methods
boolean assignmentWriteEnabled()
Check if writing resource assignments is enabled
void cacheMessages(List<Message> messages)
ClusterConfiguration getClusterConfig()
ClusterConstraints getConstraint(ClusterConstraints.ConstraintType type)
Returns the ClusterConstraints for a given constraintType
Map<StringClusterConstraints> getConstraintMap()
Map<StringControllerContextHolder> getContextMap()
Map<StringCurrentState> getCurrentState(String instanceName, String clientSessionId)
Provides the current state of the node for a given session id, the sessionid can be got from LiveInstance
Set<String> getDisabledInstancesForPartition(String partition)
Some partitions might be disabled on specific nodes.
IdealState getIdealState(String resourceName)
Provides the idealstate for a given resource
Map<StringMap<StringString>> getIdealStateRules()
Map<StringIdealState> getIdealStates()
Retrieves the idealstates for all resources
Map<StringInstanceConfig> getInstanceConfigMap()
Returns the instance config map
LiveInstance getLeader()
Get the live instance associated with the controller leader
Map<StringLiveInstance> getLiveInstances()
Returns the LiveInstances for each of the instances that are curretnly up and running
Map<StringMap<StringMessage>> getMessageMap()
Provides all outstanding messages
Map<StringMessage> getMessages(String instanceName)
Provides a list of current outstanding transitions on a given instance.
PauseSignal getPauseSignal()
Get the pause signal (if any)
int getReplicas(String resourceName)
Returns the number of replicas for a given resource.
Map<StringResourceConfiguration> getResourceConfigs()
Retrieves the configs for all resources
StateModelDefinition getStateModelDef(String stateModelDefRef)
Provides the state model definition for a given state model
Map<StringStateModelDefinition> getStateModelDefMap()
Provides all state model definitions
synchronized boolean refresh(HelixDataAccessor accessor)
This refreshes the cluster data by re-fetching the data from zookeeper in an efficient way
synchronized void requireFullRefresh()
Indicate that a full read should be done on the next refresh
void setAssignmentWritePolicy(boolean enable)
Enable or disable writing resource assignments
synchronized void setConstraints(List<ClusterConstraints> constraints)
synchronized void setIdealStates(List<IdealState> idealStates)
synchronized void setInstanceConfigs(List<InstanceConfig> instanceConfigs)
synchronized void setLiveInstances(List<LiveInstance> liveInstances)
synchronized void setResourceConfigs(List<ResourceConfiguration> resourceConfigs)
String toString()
toString method to print the entire cluster state
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ClusterDataCache ()

Public Methods

public boolean assignmentWriteEnabled ()

Check if writing resource assignments is enabled

Returns
  • true if enabled, false if disabled

public void cacheMessages (List<Message> messages)

public ClusterConfiguration getClusterConfig ()

public ClusterConstraints getConstraint (ClusterConstraints.ConstraintType type)

Returns the ClusterConstraints for a given constraintType

public Map<StringClusterConstraints> getConstraintMap ()

public Map<StringControllerContextHolder> getContextMap ()

public Map<StringCurrentState> getCurrentState (String instanceName, String clientSessionId)

Provides the current state of the node for a given session id, the sessionid can be got from LiveInstance

public Set<String> getDisabledInstancesForPartition (String partition)

Some partitions might be disabled on specific nodes. This method allows one to fetch the set of nodes where a given partition is disabled

public IdealState getIdealState (String resourceName)

Provides the idealstate for a given resource

public Map<StringMap<StringString>> getIdealStateRules ()

public Map<StringIdealState> getIdealStates ()

Retrieves the idealstates for all resources

public Map<StringInstanceConfig> getInstanceConfigMap ()

Returns the instance config map

public LiveInstance getLeader ()

Get the live instance associated with the controller leader

Returns
  • LiveInstance

public Map<StringLiveInstance> getLiveInstances ()

Returns the LiveInstances for each of the instances that are curretnly up and running

public Map<StringMap<StringMessage>> getMessageMap ()

Provides all outstanding messages

public Map<StringMessage> getMessages (String instanceName)

Provides a list of current outstanding transitions on a given instance.

public PauseSignal getPauseSignal ()

Get the pause signal (if any)

Returns
  • PauseSignal

public int getReplicas (String resourceName)

Returns the number of replicas for a given resource.

public Map<StringResourceConfiguration> getResourceConfigs ()

Retrieves the configs for all resources

public StateModelDefinition getStateModelDef (String stateModelDefRef)

Provides the state model definition for a given state model

public Map<StringStateModelDefinition> getStateModelDefMap ()

Provides all state model definitions

Returns
  • state model definition map

public synchronized boolean refresh (HelixDataAccessor accessor)

This refreshes the cluster data by re-fetching the data from zookeeper in an efficient way

public synchronized void requireFullRefresh ()

Indicate that a full read should be done on the next refresh

public void setAssignmentWritePolicy (boolean enable)

Enable or disable writing resource assignments

Parameters
enable true to enable, false to disable

public synchronized void setConstraints (List<ClusterConstraints> constraints)

public synchronized void setIdealStates (List<IdealState> idealStates)

public synchronized void setInstanceConfigs (List<InstanceConfig> instanceConfigs)

public synchronized void setLiveInstances (List<LiveInstance> liveInstances)

public synchronized void setResourceConfigs (List<ResourceConfiguration> resourceConfigs)

public String toString ()

toString method to print the entire cluster state