Package org.apache.storm.cluster

# Class ClusterUtils

java.lang.Object
org.apache.storm.cluster.ClusterUtils

public class ClusterUtils extends Object

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ASSIGNMENTS_ROOT`
  `static final String`
  `ASSIGNMENTS_SUBTREE`
  `static final String`
  `BACKPRESSURE_ROOT`
  `static final String`
  `BACKPRESSURE_SUBTREE`
  `static final String`
  `BLOBSTORE_MAX_KEY_SEQUENCE_NUMBER_ROOT`
  `static final String`
  `BLOBSTORE_MAX_KEY_SEQUENCE_NUMBER_SUBTREE`
  `static final String`
  `BLOBSTORE_ROOT`
  `static final String`
  `BLOBSTORE_SUBTREE`
  `static final String`
  `CREDENTIALS_ROOT`
  `static final String`
  `CREDENTIALS_SUBTREE`
  `static final String`
  `ERRORS_ROOT`
  `static final String`
  `ERRORS_SUBTREE`
  `static final String`
  `LEADERINFO_ROOT`
  `static final String`
  `LEADERINFO_SUBTREE`
  `static final String`
  `LOGCONFIG_ROOT`
  `static final String`
  `LOGCONFIG_SUBTREE`
  `static final String`
  `NIMBUSES_ROOT`
  `static final String`
  `NIMBUSES_SUBTREE`
  `static final String`
  `PROFILERCONFIG_ROOT`
  `static final String`
  `PROFILERCONFIG_SUBTREE`
  `static final String`
  `SECRET_KEYS_ROOT`
  `static final String`
  `SECRET_KEYS_SUBTREE`
  `static final String`
  `STORMS_ROOT`
  `static final String`
  `STORMS_SUBTREE`
  `static final String`
  `SUPERVISORS_ROOT`
  `static final String`
  `SUPERVISORS_SUBTREE`
  `static final String`
  `WORKERBEATS_ROOT`
  `static final String`
  `WORKERBEATS_SUBTREE`
  `static final String`
  `ZK_SEPERATOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClusterUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `assignmentPath(String id)`
  `static String`
  `backpressurePath(String stormId, String shortPath)`
  Get the backpressure znode full path.
  `static String`
  `backpressurePath(String stormId, String node, Long port)`
  `static String`
  `backpressureStormRoot(String stormId)`
  `static String`
  `blobstoreMaxKeySequenceNumberPath(String key)`
  `static String`
  `blobstorePath(String key)`
  `static Map<ExecutorInfo,ExecutorBeat>`
  `convertExecutorBeats(List<ExecutorInfo> executors, ClusterWorkerHeartbeat workerHeartbeat)`
  Ensures that we only return heartbeats for executors assigned to this worker.
  `static String`
  `credentialsPath(String stormId)`
  `static String`
  `errorPath(String stormId, String componentId)`
  `static String`
  `errorStormRoot(String stormId)`
  `static String`
  `lastErrorPath(String stormId, String componentId)`
  `static String`
  `logConfigPath(String stormId)`
  Get the path to the log config for a topology.
  `static <T> T`
  `maybeDeserialize(byte[] serialized, Class<T> clazz)`
  `static IStateStorage`
  `mkStateStorage(Map<String,Object> config, Map<String,Object> authConf, ClusterStateContext context)`
  `IStateStorage`
  `mkStateStorageImpl(Map<String,Object> config, Map<String,Object> authConf, ClusterStateContext context)`
  `static IStormClusterState`
  `mkStormClusterState(Object stateStorage, ILocalAssignmentsBackend backend, ClusterStateContext context)`
  `static IStormClusterState`
  `mkStormClusterState(Object stateStorage, ClusterStateContext context)`
  `IStormClusterState`
  `mkStormClusterStateImpl(Object stateStorage, ILocalAssignmentsBackend backend, ClusterStateContext context)`
  `static List<org.apache.storm.shade.org.apache.zookeeper.data.ACL>`
  `mkTopoReadOnlyAcls(Map<String,Object> topoConf)`
  Get ZK ACLs for a topology to have read only access.
  `static List<org.apache.storm.shade.org.apache.zookeeper.data.ACL>`
  `mkTopoReadWriteAcls(Map<String,Object> topoConf)`
  Get ZK ACLs for a topology to have read/write access.
  `static String`
  `nimbusPath(String id)`
  `static String`
  `profilerConfigPath(String stormId)`
  `static String`
  `profilerConfigPath(String stormId, String host, Long port, ProfileAction requestType)`
  `static void`
  `resetInstance()`
  Resets the singleton instance to the default.
  `static String`
  `secretKeysPath(WorkerTokenServiceType type)`
  Get the base path where secret keys are stored for a given service.
  `static String`
  `secretKeysPath(WorkerTokenServiceType type, String topologyId)`
  Get the path to secret keys for a specific topology.
  `static String`
  `secretKeysPath(WorkerTokenServiceType type, String topologyId, long version)`
  Get the path to a specific secret key.
  `static void`
  `setInstance(ClusterUtils u)`
  Provide an instance of this class for delegates to use.
  `static String`
  `stormPath(String id)`
  `static String`
  `stringifyError(Throwable error)`
  `static String`
  `supervisorPath(String id)`
  `static String`
  `workerbeatPath(String stormId, String node, Long port)`
  `static String`
  `workerbeatStormRoot(String stormId)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### ZK_SEPERATOR

    public static final String ZK_SEPERATOR
    See Also:
      - Constant Field Values

  - ### ASSIGNMENTS_ROOT

    public static final String ASSIGNMENTS_ROOT
    See Also:
      - Constant Field Values

  - ### STORMS_ROOT

    public static final String STORMS_ROOT
    See Also:
      - Constant Field Values

  - ### SUPERVISORS_ROOT

    public static final String SUPERVISORS_ROOT
    See Also:
      - Constant Field Values

  - ### WORKERBEATS_ROOT

    public static final String WORKERBEATS_ROOT
    See Also:
      - Constant Field Values

  - ### BACKPRESSURE_ROOT

    public static final String BACKPRESSURE_ROOT
    See Also:
      - Constant Field Values

  - ### LEADERINFO_ROOT

    public static final String LEADERINFO_ROOT
    See Also:
      - Constant Field Values

  - ### ERRORS_ROOT

    public static final String ERRORS_ROOT
    See Also:
      - Constant Field Values

  - ### BLOBSTORE_ROOT

    public static final String BLOBSTORE_ROOT
    See Also:
      - Constant Field Values

  - ### BLOBSTORE_MAX_KEY_SEQUENCE_NUMBER_ROOT

    public static final String BLOBSTORE_MAX_KEY_SEQUENCE_NUMBER_ROOT
    See Also:
      - Constant Field Values

  - ### NIMBUSES_ROOT

    public static final String NIMBUSES_ROOT
    See Also:
      - Constant Field Values

  - ### CREDENTIALS_ROOT

    public static final String CREDENTIALS_ROOT
    See Also:
      - Constant Field Values

  - ### LOGCONFIG_ROOT

    public static final String LOGCONFIG_ROOT
    See Also:
      - Constant Field Values

  - ### PROFILERCONFIG_ROOT

    public static final String PROFILERCONFIG_ROOT
    See Also:
      - Constant Field Values

  - ### SECRET_KEYS_ROOT

    public static final String SECRET_KEYS_ROOT
    See Also:
      - Constant Field Values

  - ### ASSIGNMENTS_SUBTREE

    public static final String ASSIGNMENTS_SUBTREE
    See Also:
      - Constant Field Values

  - ### STORMS_SUBTREE

    public static final String STORMS_SUBTREE
    See Also:
      - Constant Field Values

  - ### SUPERVISORS_SUBTREE

    public static final String SUPERVISORS_SUBTREE
    See Also:
      - Constant Field Values

  - ### WORKERBEATS_SUBTREE

    public static final String WORKERBEATS_SUBTREE
    See Also:
      - Constant Field Values

  - ### BACKPRESSURE_SUBTREE

    public static final String BACKPRESSURE_SUBTREE
    See Also:
      - Constant Field Values

  - ### LEADERINFO_SUBTREE

    public static final String LEADERINFO_SUBTREE
    See Also:
      - Constant Field Values

  - ### ERRORS_SUBTREE

    public static final String ERRORS_SUBTREE
    See Also:
      - Constant Field Values

  - ### BLOBSTORE_SUBTREE

    public static final String BLOBSTORE_SUBTREE
    See Also:
      - Constant Field Values

  - ### BLOBSTORE_MAX_KEY_SEQUENCE_NUMBER_SUBTREE

    public static final String BLOBSTORE_MAX_KEY_SEQUENCE_NUMBER_SUBTREE
    See Also:
      - Constant Field Values

  - ### NIMBUSES_SUBTREE

    public static final String NIMBUSES_SUBTREE
    See Also:
      - Constant Field Values

  - ### CREDENTIALS_SUBTREE

    public static final String CREDENTIALS_SUBTREE
    See Also:
      - Constant Field Values

  - ### LOGCONFIG_SUBTREE

    public static final String LOGCONFIG_SUBTREE
    See Also:
      - Constant Field Values

  - ### PROFILERCONFIG_SUBTREE

    public static final String PROFILERCONFIG_SUBTREE
    See Also:
      - Constant Field Values

  - ### SECRET_KEYS_SUBTREE

    public static final String SECRET_KEYS_SUBTREE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ClusterUtils

    public ClusterUtils()

- ## Method Details

  - ### setInstance

    public static void setInstance(ClusterUtils u)
    Provide an instance of this class for delegates to use. To mock out delegated methods, provide an instance of a subclass that overrides the implementation of the delegated method.
    Parameters:
      `u` - a Cluster instance

  - ### resetInstance

    public static void resetInstance()
    Resets the singleton instance to the default. This is helpful to reset the class to its original functionality when mocking is no longer desired.

  - ### mkTopoReadWriteAcls

    public static List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> mkTopoReadWriteAcls(Map<String,Object> topoConf)
    Get ZK ACLs for a topology to have read/write access.
    Parameters:
      `topoConf` - the topology config.
    Returns:
      the ACLs.

  - ### mkTopoReadOnlyAcls

    public static List<org.apache.storm.shade.org.apache.zookeeper.data.ACL> mkTopoReadOnlyAcls(Map<String,Object> topoConf)
    Get ZK ACLs for a topology to have read only access.
    Parameters:
      `topoConf` - the topology config.
    Returns:
      the ACLs.

  - ### supervisorPath

    public static String supervisorPath(String id)

  - ### assignmentPath

    public static String assignmentPath(String id)

  - ### blobstorePath

    public static String blobstorePath(String key)

  - ### blobstoreMaxKeySequenceNumberPath

    public static String blobstoreMaxKeySequenceNumberPath(String key)

  - ### nimbusPath

    public static String nimbusPath(String id)

  - ### stormPath

    public static String stormPath(String id)

  - ### workerbeatStormRoot

    public static String workerbeatStormRoot(String stormId)

  - ### workerbeatPath

    public static String workerbeatPath(String stormId, String node, Long port)

  - ### backpressureStormRoot

    public static String backpressureStormRoot(String stormId)

  - ### backpressurePath

    public static String backpressurePath(String stormId, String node, Long port)

  - ### backpressurePath

    public static String backpressurePath(String stormId, String shortPath)
    Get the backpressure znode full path.
    Parameters:
      `stormId` - The topology id
      `shortPath` - A string in the form of "node-port"
    Returns:
      The backpressure znode path

  - ### errorStormRoot

    public static String errorStormRoot(String stormId)

  - ### errorPath

    public static String errorPath(String stormId, String componentId)

  - ### lastErrorPath

    public static String lastErrorPath(String stormId, String componentId)

  - ### credentialsPath

    public static String credentialsPath(String stormId)

  - ### logConfigPath

    public static String logConfigPath(String stormId)
    Get the path to the log config for a topology.
    Parameters:
      `stormId` - the topology id.
    Returns:
      the path to the config.

  - ### profilerConfigPath

    public static String profilerConfigPath(String stormId)

  - ### profilerConfigPath

    public static String profilerConfigPath(String stormId, String host, Long port, ProfileAction requestType)

  - ### secretKeysPath

    public static String secretKeysPath(WorkerTokenServiceType type)
    Get the base path where secret keys are stored for a given service.
    Parameters:
      `type` - the service we are interested in.
    Returns:
      the path to that service root.

  - ### secretKeysPath

    public static String secretKeysPath(WorkerTokenServiceType type, String topologyId)
    Get the path to secret keys for a specific topology.
    Parameters:
      `type` - the service the secret is for.
      `topologyId` - the topology the secret is for.
    Returns:
      the path to the list of secret keys.

  - ### secretKeysPath

    public static String secretKeysPath(WorkerTokenServiceType type, String topologyId, long version)
    Get the path to a specific secret key.
    Parameters:
      `type` - the service the secret is for.
      `topologyId` - the topology the secret is for.
      `version` - the version the secret is for.
    Returns:
      the path to the secret.

  - ### maybeDeserialize

    public static <T> T maybeDeserialize(byte[] serialized, Class<T> clazz)

  - ### convertExecutorBeats

    public static Map<ExecutorInfo,ExecutorBeat> convertExecutorBeats(List<ExecutorInfo> executors, ClusterWorkerHeartbeat workerHeartbeat)
    Ensures that we only return heartbeats for executors assigned to this worker.

  - ### mkStateStorage

    public static IStateStorage mkStateStorage(Map<String,Object> config, Map<String,Object> authConf, ClusterStateContext context) throws Exception
    Throws:
      `Exception`

  - ### mkStormClusterState

    public static IStormClusterState mkStormClusterState(Object stateStorage, ILocalAssignmentsBackend backend, ClusterStateContext context) throws Exception
    Throws:
      `Exception`

  - ### mkStormClusterState

    public static IStormClusterState mkStormClusterState(Object stateStorage, ClusterStateContext context) throws Exception
    Throws:
      `Exception`

  - ### stringifyError

    public static String stringifyError(Throwable error)

  - ### mkStormClusterStateImpl

    public IStormClusterState mkStormClusterStateImpl(Object stateStorage, ILocalAssignmentsBackend backend, ClusterStateContext context) throws Exception
    Throws:
      `Exception`

  - ### mkStateStorageImpl

    public IStateStorage mkStateStorageImpl(Map<String,Object> config, Map<String,Object> authConf, ClusterStateContext context) throws Exception
    Throws:
      `Exception`