Package org.apache.storm.cluster
Interface IStormClusterState
- All Known Implementing Classes:
StormClusterStateImpl
public interface IStormClusterState
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addNimbusHost
(String nimbusId, NimbusSummary nimbusSummary) void
addPrivateWorkerKey
(WorkerTokenServiceType type, String topologyId, long keyVersion, PrivateWorkerKey key) Store a new version of a private key.default Map<String,
SupervisorInfo> Get all of the supervisors with the ID as the key.default Map<String,
SupervisorInfo> allSupervisorInfo
(Runnable callback) Get all supervisor info.assignmentInfo
(String stormId, Runnable callback) Get the assignment based on storm id from local backend.assignmentInfoWithVersion
(String stormId, Runnable callback) assignments
(Runnable callback) Get all the topologies assignments mapping stormId -> Assignment from local backend.assignmentVersion
(String stormId, Runnable callback) Deprecated, for removal: This API element is subject to removal in a future version.blobstoreInfo
(String blobKey) credentials
(String stormId, Runnable callback) void
deleteTopologyProfileRequests
(String stormId, ProfileRequest profileRequest) void
Get leader info from state store, which was written when a master gains leadership.long
getNextPrivateWorkerKeyVersion
(WorkerTokenServiceType type, String topologyId) Get the next key version number that should be used for this topology id.getPrivateWorkerKey
(WorkerTokenServiceType type, String topologyId, long keyVersion) Get a private key used to validate a token is correct.Get a topology ID from the name of a topology.getTopologyProfileRequests
(String stormId) getWorkerHeartbeat
(String stormId, String node, Long port) getWorkerProfileRequests
(String stormId, NodeInfo nodeInfo) Get a list of all topologyIds that currently have private worker keys stored, of any kind.boolean
Flag to indicate if the assignments synced successfully, seesyncRemoteAssignments(Map)
.boolean
Flag to indicate if the Pacameker is backend store.nimbuses()
remoteAssignmentInfo
(String stormId, Runnable callback) Get the assignment based on storm id from remote state store, eg: ZK.void
removeAllPrivateWorkerKeys
(String topologyId) Remove all of the worker keys for a given topology.void
removeBackpressure
(String stormId) Deprecated, for removal: This API element is subject to removal in a future version.void
removeBlobstoreKey
(String blobKey) void
removeExpiredPrivateWorkerKeys
(String topologyId) Remove all keys for the given topology that have expired.void
removeKeyVersion
(String blobKey) void
removeStorm
(String stormId) void
removeStormBase
(String stormId) void
removeWorkerBackpressure
(String stormId, String node, Long port) Deprecated, for removal: This API element is subject to removal in a future version.void
removeWorkerHeartbeat
(String stormId, String node, Long port) void
void
setAssignment
(String stormId, Assignment info, Map<String, Object> topoConf) void
Mark the assignments as synced successfully, seeisAssignmentsBackendSynchronized()
.void
setCredentials
(String stormId, Credentials creds, Map<String, Object> topoConf) void
void
setupBackpressure
(String stormId, Map<String, Object> topoConf) Deprecated, for removal: This API element is subject to removal in a future version.void
setupBlob
(String key, NimbusInfo nimbusInfo, Integer versionInfo) void
setupErrors
(String stormId, Map<String, Object> topoConf) void
setupHeatbeats
(String stormId, Map<String, Object> topoConf) void
setWorkerProfileRequest
(String stormId, ProfileRequest profileRequest) Get a storm base for a topology.Get storm id from passed name, null if the name doesn't exist on cluster.void
supervisorHeartbeat
(String supervisorId, SupervisorInfo info) supervisorInfo
(String supervisorId) supervisors
(Runnable callback) void
syncRemoteAssignments
(Map<String, byte[]> remote) Sync the remote state store assignments to local backend, used when master gains leadership, seeorg.apache.storm.nimbus.LeaderListenerCallback
.void
syncRemoteIds
(Map<String, String> ids) Sync all the active storm ids of the cluster, used now when master gains leadership.void
teardownHeartbeats
(String stormId) void
teardownTopologyErrors
(String stormId) boolean
topologyBackpressure
(String stormId, long timeoutMs, Runnable callback) Deprecated, for removal: This API element is subject to removal in a future version.topologyLogConfig
(String stormId, Runnable cb) void
updateStorm
(String stormId, StormBase newElems) void
workerHeartbeat
(String stormId, String node, Long port, ClusterWorkerHeartbeat info)
-
Method Details
-
assignments
-
assignmentInfo
Get the assignment based on storm id from local backend.- Parameters:
stormId
- topology idcallback
- callback function- Returns:
Assignment
-
remoteAssignmentInfo
Get the assignment based on storm id from remote state store, eg: ZK.- Parameters:
stormId
- topology idcallback
- callback function- Returns:
Assignment
-
assignmentsInfo
Map<String,Assignment> assignmentsInfo()Get all the topologies assignments mapping stormId -> Assignment from local backend.- Returns:
- stormId -> Assignment mapping
-
syncRemoteAssignments
Sync the remote state store assignments to local backend, used when master gains leadership, seeorg.apache.storm.nimbus.LeaderListenerCallback
.- Parameters:
remote
- assigned assignments for a specificIStormClusterState
instance, usually a supervisor/node.
-
isAssignmentsBackendSynchronized
boolean isAssignmentsBackendSynchronized()Flag to indicate if the assignments synced successfully, seesyncRemoteAssignments(Map)
.- Returns:
- true if is synced successfully
-
isPacemakerStateStore
boolean isPacemakerStateStore()Flag to indicate if the Pacameker is backend store.- Returns:
- true if Pacemaker is being used as StateStore
-
setAssignmentsBackendSynchronized
void setAssignmentsBackendSynchronized()Mark the assignments as synced successfully, seeisAssignmentsBackendSynchronized()
. -
assignmentInfoWithVersion
-
assignmentVersion
- Throws:
Exception
-
blobstoreInfo
-
nimbuses
List<NimbusSummary> nimbuses() -
addNimbusHost
-
activeStorms
-
stormBase
Get a storm base for a topology.- Parameters:
stormId
- the id of the topologycallback
- something to call if the data changes (best effort)- Returns:
- the StormBase or null if it is not alive.
-
stormId
Get storm id from passed name, null if the name doesn't exist on cluster.- Parameters:
stormName
- storm name- Returns:
- storm id
-
syncRemoteIds
Sync all the active storm ids of the cluster, used now when master gains leadership.- Parameters:
ids
- stormName -> stormId mapping
-
getWorkerHeartbeat
-
getWorkerProfileRequests
-
getTopologyProfileRequests
-
setWorkerProfileRequest
-
deleteTopologyProfileRequests
-
executorBeats
Map<ExecutorInfo,ExecutorBeat> executorBeats(String stormId, Map<List<Long>, NodeInfo> executorNodePort) -
supervisors
-
supervisorInfo
-
setupHeatbeats
-
teardownHeartbeats
-
teardownTopologyErrors
-
heartbeatStorms
-
errorTopologies
-
backpressureTopologies
Deprecated, for removal: This API element is subject to removal in a future version.Get backpressure topologies. Note: In Storm 2.0. Retained for enabling transition from 1.x. Will be removed soon. -
getLeader
Get leader info from state store, which was written when a master gains leadership.Caution: it can not be used for fencing and is only for informational purposes because we use ZK as our backend now, which could have a overdue info of nodes.
- Parameters:
callback
- callback func- Returns:
NimbusInfo
-
setTopologyLogConfig
-
topologyLogConfig
-
workerHeartbeat
-
removeWorkerHeartbeat
-
supervisorHeartbeat
-
topologyBackpressure
@Deprecated(forRemoval=true, since="2.0.0") boolean topologyBackpressure(String stormId, long timeoutMs, Runnable callback) Deprecated, for removal: This API element is subject to removal in a future version.Get topoloy backpressure. Note: In Storm 2.0. Retained for enabling transition from 1.x. Will be removed soon. -
setupBackpressure
@Deprecated(forRemoval=true, since="2.0.0") void setupBackpressure(String stormId, Map<String, Object> topoConf) Deprecated, for removal: This API element is subject to removal in a future version.Setup backpressure. Note: In Storm 2.0. Retained for enabling transition from 1.x. Will be removed soon. -
removeBackpressure
Deprecated, for removal: This API element is subject to removal in a future version.Remove backpressure. Note: In Storm 2.0. Retained for enabling transition from 1.x. Will be removed soon. -
removeWorkerBackpressure
@Deprecated(forRemoval=true, since="2.0.0") void removeWorkerBackpressure(String stormId, String node, Long port) Deprecated, for removal: This API element is subject to removal in a future version.Remove worker backpressure. Note: In Storm 2.0. Retained for enabling transition from 1.x. Will be removed soon. -
activateStorm
-
updateStorm
-
removeStormBase
-
setAssignment
-
setupBlob
-
activeKeys
-
blobstore
-
removeStorm
-
removeBlobstoreKey
-
removeKeyVersion
-
reportError
-
setupErrors
-
errors
-
lastError
-
setCredentials
-
credentials
-
disconnect
void disconnect() -
getPrivateWorkerKey
PrivateWorkerKey getPrivateWorkerKey(WorkerTokenServiceType type, String topologyId, long keyVersion) Get a private key used to validate a token is correct. This is expected to be called from a privileged daemon, and the ACLs should be set up to only allow nimbus and these privileged daemons access to these private keys.- Parameters:
type
- the type of service the key is for.topologyId
- the topology id the key is for.keyVersion
- the version of the key this is for.- Returns:
- the private key or null if it could not be found.
-
addPrivateWorkerKey
void addPrivateWorkerKey(WorkerTokenServiceType type, String topologyId, long keyVersion, PrivateWorkerKey key) Store a new version of a private key. This is expected to only ever be called from nimbus. All ACLs however need to be setup to allow the given services access to the stored information.- Parameters:
type
- the type of service this key is for.topologyId
- the topology this key is forkeyVersion
- the version of the key this is for.key
- the key to store.
-
getNextPrivateWorkerKeyVersion
Get the next key version number that should be used for this topology id. This is expected to only ever be called from nimbus, but it is acceptable if the ACLs are setup so that it can work from a privileged daemon for the given service.- Parameters:
type
- the type of service this is for.topologyId
- the topology id this is for.- Returns:
- the next version number. It should be 0 for a new topology id/service combination.
-
removeExpiredPrivateWorkerKeys
Remove all keys for the given topology that have expired. The number of keys should be small enough that doing an exhaustive scan of them all is acceptable as there is no guarantee that expiration time and version number are related. This should be for all service types. This is expected to only ever be called from nimbus and some ACLs may be setup so being called from other daemons will cause it to fail.- Parameters:
topologyId
- the id of the topology to scan.
-
removeAllPrivateWorkerKeys
Remove all of the worker keys for a given topology. Used to clean up after a topology finishes. This is expected to only ever be called from nimbus and ideally should only ever work from nimbus.- Parameters:
topologyId
- the topology to clean up after.
-
idsOfTopologiesWithPrivateWorkerKeys
Get a list of all topologyIds that currently have private worker keys stored, of any kind. This is expected to only ever be called from nimbus.- Returns:
- the list of topology ids with any kind of private worker key stored.
-
allSupervisorInfo
Get all of the supervisors with the ID as the key. -
allSupervisorInfo
Get all supervisor info.- Parameters:
callback
- be alerted if the list of supervisors change- Returns:
- All of the supervisors with the ID as the key
-
getTopoId
Get a topology ID from the name of a topology.- Parameters:
topologyName
- the name of the topology to look for- Returns:
- the id of the topology or null if it is not alive.
-
topologyBases
-