Package com.cognite.client.statestore
Class RawStateStore
java.lang.Object
com.cognite.client.statestore.AbstractStateStore
com.cognite.client.statestore.RawStateStore
- All Implemented Interfaces:
StateStore,Closeable,AutoCloseable
A state store using a local file to persist state entries.
Abstract parent class for all state store implementations.
-
Field Summary
Fields inherited from class com.cognite.client.statestore.AbstractStateStore
COLUMN_KEY_HIGH, COLUMN_KEY_LOW, DEFAULT_MAX_COMMIT_INTERVAL, deletedEntries, executor, LOG, MAX_MAX_COMMIT_INTERVAL, MIN_MAX_COMMIT_INTERVAL, modifiedEntries, recurringTask, stateMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Commit the current states to the persistent store.voidload()Load the states from the persistent store.static RawStateStoreof(CogniteClient client, String dbName, String tableName) Initialize a state store backed by a CDF Raw table.withMaxCommitInterval(Duration interval) Sets the max commit interval.Methods inherited from class com.cognite.client.statestore.AbstractStateStore
close, deleteState, expandHigh, expandLow, getHigh, getLow, getState, isOutsideState, keySet, setHigh, setLow, start, stop, verifyStateMap
-
Constructor Details
-
RawStateStore
public RawStateStore()
-
-
Method Details
-
of
Initialize a state store backed by a CDF Raw table.- Parameters:
client- Cognite client to use for the accessing the Raw tabledbName- The name of the Raw data base hosting the backing tabletableName- The name of the Raw table- Returns:
- the state store.
-
withMaxCommitInterval
Sets the max commit interval. When you activate the commit background thread viaAbstractStateStore.start(), the state will be committed to persistent storage at least every commit interval. The default max commit interval is 20 seconds.- Parameters:
interval- The target max upload interval.- Returns:
- The
RawStateStorewith the upload interval configured.
-
load
Load the states from the persistent store.- Specified by:
loadin interfaceStateStore- Specified by:
loadin classAbstractStateStore- Throws:
Exception
-
commit
Commit the current states to the persistent store. Will overwrite/replace previously persisted states.- Specified by:
commitin interfaceStateStore- Specified by:
commitin classAbstractStateStore- Throws:
Exception
-