Class DbDistributionState
java.lang.Object
io.camunda.zeebe.engine.state.distribution.DbDistributionState
- All Implemented Interfaces:
DistributionState
,MutableDistributionState
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.zeebe.engine.state.immutable.DistributionState
DistributionState.PendingDistributionVisitor
-
Constructor Summary
ConstructorsConstructorDescriptionDbDistributionState
(ZeebeDb<ZbColumnFamilies> zeebeDb, TransactionContext transactionContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommandDistribution
(long distributionKey, CommandDistributionRecord commandDistributionRecord) Adds a distribution to the statevoid
addPendingDistribution
(long distributionKey, int partition) Adds a pending distribution to the statevoid
Visits each persisted pending distribution, providing both the key of that distribution and theCommandDistributionRecord
.getCommandDistributionRecord
(long distributionKey, int partition) Returns theCommandDistributionRecord
for the given distribution key.boolean
hasPendingDistribution
(long distributionKey) Returns whether there are any distributions pending for a given key.boolean
hasPendingDistribution
(long distributionKey, int partition) Returns whether a specific distribution for a specific partition is pending.void
removeCommandDistribution
(long distributionKey) Removed a distribution from the statevoid
removePendingDistribution
(long distributionKey, int partition) Removes a pending distribution fromm the state
-
Constructor Details
-
DbDistributionState
public DbDistributionState(ZeebeDb<ZbColumnFamilies> zeebeDb, TransactionContext transactionContext)
-
-
Method Details
-
addCommandDistribution
public void addCommandDistribution(long distributionKey, CommandDistributionRecord commandDistributionRecord) Description copied from interface:MutableDistributionState
Adds a distribution to the state- Specified by:
addCommandDistribution
in interfaceMutableDistributionState
- Parameters:
distributionKey
- the key of the distributioncommandDistributionRecord
- the distribution record that needs to be stored
-
removeCommandDistribution
public void removeCommandDistribution(long distributionKey) Description copied from interface:MutableDistributionState
Removed a distribution from the state- Specified by:
removeCommandDistribution
in interfaceMutableDistributionState
- Parameters:
distributionKey
- the key of the distribution that will be removed
-
addPendingDistribution
public void addPendingDistribution(long distributionKey, int partition) Description copied from interface:MutableDistributionState
Adds a pending distribution to the state- Specified by:
addPendingDistribution
in interfaceMutableDistributionState
- Parameters:
distributionKey
- the key of the distributionpartition
- the partition for which the distribution is pending
-
removePendingDistribution
public void removePendingDistribution(long distributionKey, int partition) Description copied from interface:MutableDistributionState
Removes a pending distribution fromm the state- Specified by:
removePendingDistribution
in interfaceMutableDistributionState
- Parameters:
distributionKey
- the key of the pending distribution that will be removedpartition
- the partition of the pending distribution that will be removed
-
hasPendingDistribution
public boolean hasPendingDistribution(long distributionKey) Description copied from interface:DistributionState
Returns whether there are any distributions pending for a given key.- Specified by:
hasPendingDistribution
in interfaceDistributionState
- Parameters:
distributionKey
- the key of the distribution- Returns:
- true if there are pending distributions for the given key, otherwise false
-
hasPendingDistribution
public boolean hasPendingDistribution(long distributionKey, int partition) Description copied from interface:DistributionState
Returns whether a specific distribution for a specific partition is pending.- Specified by:
hasPendingDistribution
in interfaceDistributionState
- Parameters:
distributionKey
- the key of the distribution that may be pendingpartition
- the id of the partition for which the distribution might be pending- Returns:
true
if the specific pending distribution exists, otherwisefalse
.
-
getCommandDistributionRecord
Description copied from interface:DistributionState
Returns theCommandDistributionRecord
for the given distribution key. This method takes a partition id. This is only used to set the partition property in theCommandDistributionRecord
. Doing so allows us to return a whole record, without the need to remember setting the partition everytime this method is called.- Specified by:
getCommandDistributionRecord
in interfaceDistributionState
- Parameters:
distributionKey
- the key of the distributionpartition
- the partition to distribute to- Returns:
- an new instance of the
CommandDistributionRecord
-
foreachPendingDistribution
Description copied from interface:DistributionState
Visits each persisted pending distribution, providing both the key of that distribution and theCommandDistributionRecord
.Note that a new instance of the record is provided for each visit, so the visitor does not have to make a copy when long term access is needed.
- Specified by:
foreachPendingDistribution
in interfaceDistributionState
- Parameters:
visitor
- Each pending distribution is visited by this visitor
-