Class DbDistributionState

java.lang.Object
io.camunda.zeebe.engine.state.distribution.DbDistributionState
All Implemented Interfaces:
DistributionState, MutableDistributionState

public class DbDistributionState extends Object implements MutableDistributionState
  • Constructor Details

  • 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 interface MutableDistributionState
      Parameters:
      distributionKey - the key of the distribution
      commandDistributionRecord - 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 interface MutableDistributionState
      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 interface MutableDistributionState
      Parameters:
      distributionKey - the key of the distribution
      partition - 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 interface MutableDistributionState
      Parameters:
      distributionKey - the key of the pending distribution that will be removed
      partition - 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 interface DistributionState
      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 interface DistributionState
      Parameters:
      distributionKey - the key of the distribution that may be pending
      partition - the id of the partition for which the distribution might be pending
      Returns:
      true if the specific pending distribution exists, otherwise false.
    • getCommandDistributionRecord

      public CommandDistributionRecord getCommandDistributionRecord(long distributionKey, int partition)
      Description copied from interface: DistributionState
      Returns the CommandDistributionRecord for the given distribution key. This method takes a partition id. This is only used to set the partition property in the CommandDistributionRecord. 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 interface DistributionState
      Parameters:
      distributionKey - the key of the distribution
      partition - the partition to distribute to
      Returns:
      an new instance of the CommandDistributionRecord
    • foreachPendingDistribution

      public void foreachPendingDistribution(DistributionState.PendingDistributionVisitor visitor)
      Description copied from interface: DistributionState
      Visits each persisted pending distribution, providing both the key of that distribution and the CommandDistributionRecord.

      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 interface DistributionState
      Parameters:
      visitor - Each pending distribution is visited by this visitor