Class RawStateStore

java.lang.Object
com.cognite.client.statestore.AbstractStateStore
com.cognite.client.statestore.RawStateStore
All Implemented Interfaces:
StateStore, Closeable, AutoCloseable

public abstract class RawStateStore extends AbstractStateStore
A state store using a local file to persist state entries. Abstract parent class for all state store implementations.
  • Constructor Details

    • RawStateStore

      public RawStateStore()
  • Method Details

    • of

      public static RawStateStore of(CogniteClient client, String dbName, String tableName)
      Initialize a state store backed by a CDF Raw table.
      Parameters:
      client - Cognite client to use for the accessing the Raw table
      dbName - The name of the Raw data base hosting the backing table
      tableName - The name of the Raw table
      Returns:
      the state store.
    • withMaxCommitInterval

      public RawStateStore withMaxCommitInterval(Duration interval)
      Sets the max commit interval. When you activate the commit background thread via AbstractStateStore.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 RawStateStore with the upload interval configured.
    • load

      public void load() throws Exception
      Load the states from the persistent store.
      Specified by:
      load in interface StateStore
      Specified by:
      load in class AbstractStateStore
      Throws:
      Exception
    • commit

      public void commit() throws Exception
      Commit the current states to the persistent store. Will overwrite/replace previously persisted states.
      Specified by:
      commit in interface StateStore
      Specified by:
      commit in class AbstractStateStore
      Throws:
      Exception