Class DbKeyGenerator

java.lang.Object
io.camunda.zeebe.engine.state.processing.DbKeyGenerator
All Implemented Interfaces:
KeyGenerator, KeyGeneratorControls

public final class DbKeyGenerator extends Object implements KeyGeneratorControls
  • Constructor Summary

    Constructors
    Constructor
    Description
    DbKeyGenerator(int partitionId, ZeebeDb zeebeDb, TransactionContext transactionContext)
    Initializes the key state with the corresponding partition id, so that unique keys are generated over all partitions.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the next key of a record and updates the key generator.
    void
    setKeyIfHigher(long key)
    Set the given value as the new key if it is higher than the current key.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DbKeyGenerator

      public DbKeyGenerator(int partitionId, ZeebeDb zeebeDb, TransactionContext transactionContext)
      Initializes the key state with the corresponding partition id, so that unique keys are generated over all partitions.
      Parameters:
      partitionId - the partition to determine the key start value
  • Method Details

    • nextKey

      public long nextKey()
      Description copied from interface: KeyGenerator
      Returns the next key of a record and updates the key generator.
      Specified by:
      nextKey in interface KeyGenerator
      Returns:
      the next key for a new record
    • setKeyIfHigher

      public void setKeyIfHigher(long key)
      Description copied from interface: KeyGeneratorControls
      Set the given value as the new key if it is higher than the current key.
      Specified by:
      setKeyIfHigher in interface KeyGeneratorControls
      Parameters:
      key - the new key