public class InMemoryAssignmentBackend extends Object implements ILocalAssignmentsBackend
About thread safe: idToAssignment,idToName,nameToId are all memory cache in nimbus local, for
ConcurrentHashMap is ok.| Constructor and Description |
|---|
InMemoryAssignmentBackend() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
assignments()
List all the storm runtime ids of local assignments.
|
Map<String,Assignment> |
assignmentsInfo()
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.
|
Assignment |
getAssignment(String stormId)
Get assignment as
Assignment for a storm. |
String |
getStormId(String stormName)
Get storm runtime id from local.
|
boolean |
isSynchronized()
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 |
prepare(Map conf)
Initial function for creating backend.
|
void |
removeAssignment(String stormId) |
void |
setSynchronized()
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.
|
public boolean isSynchronized()
ILocalAssignmentsBackendisSynchronized in interface ILocalAssignmentsBackendpublic void setSynchronized()
ILocalAssignmentsBackendsetSynchronized in interface ILocalAssignmentsBackendpublic void prepare(Map conf)
ILocalAssignmentsBackendprepare in interface ILocalAssignmentsBackendconf - configpublic void keepOrUpdateAssignment(String stormId, Assignment assignment)
ILocalAssignmentsBackendkeepOrUpdateAssignment in interface ILocalAssignmentsBackendstormId - storm runtime idassignment - assignment as thriftpublic Assignment getAssignment(String stormId)
ILocalAssignmentsBackendAssignment for a storm.getAssignment in interface ILocalAssignmentsBackendstormId - storm runtime idpublic void removeAssignment(String stormId)
removeAssignment in interface ILocalAssignmentsBackendpublic List<String> assignments()
ILocalAssignmentsBackendassignments in interface ILocalAssignmentsBackendpublic Map<String,Assignment> assignmentsInfo()
ILocalAssignmentsBackendassignmentsInfo in interface ILocalAssignmentsBackendpublic void syncRemoteAssignments(Map<String,byte[]> remote)
ILocalAssignmentsBackendsyncRemoteAssignments in interface ILocalAssignmentsBackendremote - specific remote assignments, if it is null, it will sync from zookeeper[only used for nimbus]public void keepStormId(String stormName, String stormId)
ILocalAssignmentsBackendkeepStormId in interface ILocalAssignmentsBackendstormName - storm namestormId - storm runtime idpublic String getStormId(String stormName)
ILocalAssignmentsBackendgetStormId in interface ILocalAssignmentsBackendstormName - name of a stormpublic void syncRemoteIds(Map<String,String> remote)
ILocalAssignmentsBackendsyncRemoteIds in interface ILocalAssignmentsBackendremote - remote ids from state storepublic void deleteStormId(String stormName)
ILocalAssignmentsBackenddeleteStormId in interface ILocalAssignmentsBackendstormName - storm namepublic void clearStateForStorm(String stormId)
ILocalAssignmentsBackendclearStateForStorm in interface ILocalAssignmentsBackendstormId - storm idpublic void close()
ILocalAssignmentsBackendclose in interface AutoCloseableclose in interface ILocalAssignmentsBackendCopyright © 2023 The Apache Software Foundation. All rights reserved.