Interface ZeebeDb<ColumnFamilyType extends Enum<ColumnFamilyType>>

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
ZeebeTransactionDb

public interface ZeebeDb<ColumnFamilyType extends Enum<ColumnFamilyType>> extends AutoCloseable
The zeebe database, to store key value pairs in different column families. The column families are defined via the specified ZeebeDb enum.

To access and store key-value pairs in a specific column family the user needs to create a ColumnFamily instance via createColumnFamily(Enum, TransactionContext, DbKey, DbValue). If the column family instances are created they are type save, which makes it possible that only the defined key and value types are stored in the column family.

  • Method Details

    • createColumnFamily

      <KeyType extends DbKey, ValueType extends DbValue> ColumnFamily<KeyType,ValueType> createColumnFamily(ColumnFamilyType columnFamily, TransactionContext context, KeyType keyInstance, ValueType valueInstance)
      Creates an instance of a specific column family to access and store key-value pairs in that column family. The key and value instances are used to ensure type safety.

      If the column family instance is created only the defined key and value types can be stored in the column family.

      Type Parameters:
      KeyType - the key type of the column family
      ValueType - the value type of the column family
      Parameters:
      columnFamily - the enum instance of the column family
      keyInstance - this instance defines the type of the column family key type
      valueInstance - this instance defines the type of the column family value type
      Returns:
      the created column family instance
    • createSnapshot

      void createSnapshot(File snapshotDir)
      Creates a snapshot of the current database in the given directory.
      Parameters:
      snapshotDir - the directory where the snapshot should be stored
    • getProperty

      Optional<String> getProperty(String propertyName)
    • createContext

      TransactionContext createContext()
    • isEmpty

      boolean isEmpty(ColumnFamilyType column, TransactionContext context)
      Checks the database if the given column is empty.
      Parameters:
      column - the enum of the column to check
      context - the context that is used to access the database
      Returns:
      true if the column is empty, otherwise false