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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
nextKey()
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.
-
-
-
Constructor Detail
-
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 Detail
-
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 interfaceKeyGenerator
- 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 interfaceKeyGeneratorControls
- Parameters:
key
- the new key
-
-