Package org.apache.storm.assignments
Interface ILocalAssignmentsBackend
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
InMemoryAssignmentBackend
Interface for storing local assignments.
-
Method Summary
Modifier and TypeMethodDescriptionList all the storm runtime ids of local assignments.Get all the local assignments of local state.void
clearStateForStorm
(String stormId) Clear all the state for a storm.void
close()
Function to release resource.void
deleteStormId
(String stormName) Delete a local cache of stormId which is mapped to a specific storm name.getAssignment
(String stormId) Get assignment asAssignment
for a storm.getStormId
(String stormName) Get storm runtime id from local.boolean
Decide if the assignments is synchronized from remote state-store.void
keepOrUpdateAssignment
(String stormId, Assignment assignment) Keep a storm assignment to local state or update old assignment.void
keepStormId
(String stormName, String stormId) Keep a mapping storm-name -> storm-id to local state.void
Initial function for creating backend.void
removeAssignment
(String stormId) void
Mark this backend as synchronized when sync work is done.void
syncRemoteAssignments
(Map<String, byte[]> remote) Sync remote assignments to local, if remote is null, we will sync it from zk.void
syncRemoteIds
(Map<String, String> remote) Sync remote storm ids to local, will just used for nimbus.
-
Method Details
-
isSynchronized
boolean isSynchronized()Decide if the assignments is synchronized from remote state-store. -
setSynchronized
void setSynchronized()Mark this backend as synchronized when sync work is done. -
prepare
Initial function for creating backend.- Parameters:
conf
- config
-
keepOrUpdateAssignment
Keep a storm assignment to local state or update old assignment.- Parameters:
stormId
- storm runtime idassignment
- assignment as thrift
-
getAssignment
Get assignment asAssignment
for a storm.- Parameters:
stormId
- storm runtime id- Returns:
- assignment
-
removeAssignment
-
assignments
List all the storm runtime ids of local assignments.- Returns:
- a list of storm ids
-
assignmentsInfo
Map<String,Assignment> assignmentsInfo()Get all the local assignments of local state.- Returns:
- mapping of storm-id -> assignment
-
syncRemoteAssignments
Sync remote assignments to local, if remote is null, we will sync it from zk.- Parameters:
remote
- specific remote assignments, if it is null, it will sync from zookeeper[only used for nimbus]
-
keepStormId
Keep a mapping storm-name -> storm-id to local state.- Parameters:
stormName
- storm namestormId
- storm runtime id
-
getStormId
Get storm runtime id from local.- Parameters:
stormName
- name of a storm- Returns:
- runtime storm id
-
syncRemoteIds
Sync remote storm ids to local, will just used for nimbus.- Parameters:
remote
- remote ids from state store
-
deleteStormId
Delete a local cache of stormId which is mapped to a specific storm name.- Parameters:
stormName
- storm name
-
clearStateForStorm
Clear all the state for a storm.- Parameters:
stormId
- storm id
-
close
void close()Function to release resource.- Specified by:
close
in interfaceAutoCloseable
-