Package org.apache.storm.utils
Class LocalState
- java.lang.Object
-
- org.apache.storm.utils.LocalState
-
public class LocalState extends Object
A simple, durable, atomic K/V database. *Very inefficient*, should only be used for occasional reads/writes. Every read/write hits disk.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerLOGstatic StringLS_APPROVED_WORKERSstatic StringLS_IDstatic StringLS_LOCAL_ASSIGNMENTSstatic StringLS_TOPO_HISTORYstatic StringLS_WORKER_HEARTBEAT
-
Constructor Summary
Constructors Constructor Description LocalState(String backingDir, boolean createBackingDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTopologyHistory(LSTopoHistory lsTopoHistory)voidcleanup(int keepVersions)voidfilterOldTopologies(long cutOffAge)Remove topologies from local state which are older than cutOffAge.org.apache.storm.thrift.TBaseget(String key)Map<String,Integer>getApprovedWorkers()Map<Integer,LocalAssignment>getLocalAssignmentsMap()StringgetSupervisorId()List<LSTopoHistory>getTopoHistoryList()LSWorkerHeartbeatgetWorkerHeartBeat()voidput(String key, org.apache.storm.thrift.TBase val)voidput(String key, org.apache.storm.thrift.TBase val, boolean cleanup)voidremove(String key)voidremove(String key, boolean cleanup)voidsetApprovedWorkers(Map<String,Integer> approvedWorkers)voidsetLocalAssignmentsMap(Map<Integer,LocalAssignment> localAssignmentMap)voidsetSupervisorId(String supervisorId)voidsetWorkerHeartBeat(LSWorkerHeartbeat workerHeartBeat)Map<String,org.apache.storm.thrift.TBase>snapshot()
-
-
-
Field Detail
-
LOG
public static final org.slf4j.Logger LOG
-
LS_WORKER_HEARTBEAT
public static final String LS_WORKER_HEARTBEAT
- See Also:
- Constant Field Values
-
LS_ID
public static final String LS_ID
- See Also:
- Constant Field Values
-
LS_LOCAL_ASSIGNMENTS
public static final String LS_LOCAL_ASSIGNMENTS
- See Also:
- Constant Field Values
-
LS_APPROVED_WORKERS
public static final String LS_APPROVED_WORKERS
- See Also:
- Constant Field Values
-
LS_TOPO_HISTORY
public static final String LS_TOPO_HISTORY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LocalState
public LocalState(String backingDir, boolean createBackingDir) throws IOException
- Throws:
IOException
-
-
Method Detail
-
get
public org.apache.storm.thrift.TBase get(String key)
-
put
public void put(String key, org.apache.storm.thrift.TBase val)
-
put
public void put(String key, org.apache.storm.thrift.TBase val, boolean cleanup)
-
remove
public void remove(String key)
-
remove
public void remove(String key, boolean cleanup)
-
cleanup
public void cleanup(int keepVersions) throws IOException- Throws:
IOException
-
getTopoHistoryList
public List<LSTopoHistory> getTopoHistoryList()
-
filterOldTopologies
public void filterOldTopologies(long cutOffAge)
Remove topologies from local state which are older than cutOffAge.
-
addTopologyHistory
public void addTopologyHistory(LSTopoHistory lsTopoHistory)
-
getSupervisorId
public String getSupervisorId()
-
setSupervisorId
public void setSupervisorId(String supervisorId)
-
getWorkerHeartBeat
public LSWorkerHeartbeat getWorkerHeartBeat()
-
setWorkerHeartBeat
public void setWorkerHeartBeat(LSWorkerHeartbeat workerHeartBeat)
-
getLocalAssignmentsMap
public Map<Integer,LocalAssignment> getLocalAssignmentsMap()
-
setLocalAssignmentsMap
public void setLocalAssignmentsMap(Map<Integer,LocalAssignment> localAssignmentMap)
-
-