Class DbKeyGenerator
java.lang.Object
io.camunda.zeebe.engine.state.processing.DbKeyGenerator
- All Implemented Interfaces:
KeyGenerator,KeyGeneratorControls
-
Constructor Summary
ConstructorsConstructorDescriptionDbKeyGenerator(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 TypeMethodDescriptionlongnextKey()Returns the next key of a record and updates the key generator.voidsetKeyIfHigher(long key) Set the given value as the new key if it is higher than the current key.
-
Constructor Details
-
DbKeyGenerator
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:KeyGeneratorReturns the next key of a record and updates the key generator.- Specified by:
nextKeyin interfaceKeyGenerator- Returns:
- the next key for a new record
-
setKeyIfHigher
public void setKeyIfHigher(long key) Description copied from interface:KeyGeneratorControlsSet the given value as the new key if it is higher than the current key.- Specified by:
setKeyIfHigherin interfaceKeyGeneratorControls- Parameters:
key- the new key
-