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 final org.slf4j.Logger`
  `LOG`
  `static final String`
  `LS_APPROVED_WORKERS`
  `static final String`
  `LS_ID`
  `static final String`
  `LS_LOCAL_ASSIGNMENTS`
  `static final String`
  `LS_TOPO_HISTORY`
  `static final String`
  `LS_WORKER_HEARTBEAT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LocalState(String backingDir, boolean createBackingDir)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addTopologyHistory(LSTopoHistory lsTopoHistory)`
  `void`
  `cleanup(int keepVersions)`
  `void`
  `filterOldTopologies(long cutOffAge)`
  Remove topologies from local state which are older than cutOffAge.
  `org.apache.storm.thrift.TBase`
  `get(String key)`
  `Map<String,Integer>`
  `getApprovedWorkers()`
  `Map<Integer,LocalAssignment>`
  `getLocalAssignmentsMap()`
  `String`
  `getSupervisorId()`
  `List<LSTopoHistory>`
  `getTopoHistoryList()`
  `LSWorkerHeartbeat`
  `getWorkerHeartBeat()`
  `void`
  `put(String key, org.apache.storm.thrift.TBase val)`
  `void`
  `put(String key, org.apache.storm.thrift.TBase val, boolean cleanup)`
  `void`
  `remove(String key)`
  `void`
  `remove(String key, boolean cleanup)`
  `void`
  `setApprovedWorkers(Map<String,Integer> approvedWorkers)`
  `void`
  `setLocalAssignmentsMap(Map<Integer,LocalAssignment> localAssignmentMap)`
  `void`
  `setSupervisorId(String supervisorId)`
  `void`
  `setWorkerHeartBeat(LSWorkerHeartbeat workerHeartBeat)`
  `Map<String,org.apache.storm.thrift.TBase>`
  `snapshot()`

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

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

- ## Field Details

  - ### 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 Details

  - ### LocalState

    public LocalState(String backingDir, boolean createBackingDir) throws IOException
    Throws:
      `IOException`

- ## Method Details

  - ### snapshot

    public Map<String,org.apache.storm.thrift.TBase> snapshot()

  - ### 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)

  - ### getApprovedWorkers

    public Map<String,Integer> getApprovedWorkers()

  - ### setApprovedWorkers

    public void setApprovedWorkers(Map<String,Integer> approvedWorkers)

  - ### getWorkerHeartBeat

    public LSWorkerHeartbeat getWorkerHeartBeat()

  - ### setWorkerHeartBeat

    public void setWorkerHeartBeat(LSWorkerHeartbeat workerHeartBeat)

  - ### getLocalAssignmentsMap

    public Map<Integer,LocalAssignment> getLocalAssignmentsMap()

  - ### setLocalAssignmentsMap

    public void setLocalAssignmentsMap(Map<Integer,LocalAssignment> localAssignmentMap)