Class DbVariableState

java.lang.Object
io.camunda.zeebe.engine.state.variable.DbVariableState
All Implemented Interfaces:
VariableState, MutableVariableState

public class DbVariableState extends Object implements MutableVariableState
  • Constructor Details

  • Method Details

    • setVariableLocal

      public void setVariableLocal(long key, long scopeKey, long processDefinitionKey, org.agrona.DirectBuffer name, org.agrona.DirectBuffer value)
      Description copied from interface: MutableVariableState
      Creates or updates the variable with name within the given scope with scopeKey, setting its value to the given value.

      This method is expected to be called directly ONLY from an EventApplier or from tests.

      Specified by:
      setVariableLocal in interface MutableVariableState
      Parameters:
      key - the variable key
      scopeKey - the local scope of the variable
      processDefinitionKey - the associated process key, mostly for monitoring purposes
      name - the name of the variable
      value - the value of the variable (MsgPack encoded)
    • setVariableLocal

      public void setVariableLocal(long key, long scopeKey, long processDefinitionKey, org.agrona.DirectBuffer name, int nameOffset, int nameLength, org.agrona.DirectBuffer value, int valueOffset, int valueLength)
      Description copied from interface: MutableVariableState
      Creates or updates the variable with name within the given scope with scopeKey, setting its value to the given value.

      This method is expected to be called directly ONLY from an EventApplier or from tests.

      Specified by:
      setVariableLocal in interface MutableVariableState
      Parameters:
      key - the variable key
      scopeKey - the local scope of the variable
      processDefinitionKey - the associated process key, mostly for monitoring purposes
      name - the name of the variable
      nameOffset - offset at which the name starts in the name buffer
      nameLength - length of the variable name in the name buffer
      value - the value of the variable (MsgPack encoded)
      valueOffset - offset at which the value starts in the value buffer
      valueLength - length of the variable value in the value buffer
    • createScope

      public void createScope(long childKey, long parentKey)
      Specified by:
      createScope in interface MutableVariableState
    • removeScope

      public void removeScope(long scopeKey)
      Specified by:
      removeScope in interface MutableVariableState
    • removeAllVariables

      public void removeAllVariables(long scopeKey)
      Specified by:
      removeAllVariables in interface MutableVariableState
    • getVariableLocal

      public org.agrona.DirectBuffer getVariableLocal(long scopeKey, org.agrona.DirectBuffer name)
      Specified by:
      getVariableLocal in interface VariableState
    • getVariable

      public org.agrona.DirectBuffer getVariable(long scopeKey, org.agrona.DirectBuffer name)
      Find the variable with the given name. If the variable is not present in the given scope then it looks in the parent scope and continues until it is found.
      Specified by:
      getVariable in interface VariableState
      Parameters:
      scopeKey - the key of the variable scope to start from
      name - the name of the variable
      Returns:
      the value of the variable, or null if it is not present in the variable scope
    • getVariable

      public org.agrona.DirectBuffer getVariable(long scopeKey, org.agrona.DirectBuffer name, int nameOffset, int nameLength)
      Find the variable with the given name. If the variable is not present in the given scope then it looks in the parent scope and continues until it is found.
      Specified by:
      getVariable in interface VariableState
      Parameters:
      scopeKey - the key of the variable scope to start from
      name - the buffer that contains the name of the variable
      nameOffset - the offset of name in the buffer
      nameLength - the length of the name in the buffer
      Returns:
      the value of the variable, or null if it is not present in the variable scope
    • getVariablesAsDocument

      public org.agrona.DirectBuffer getVariablesAsDocument(long scopeKey)
      Specified by:
      getVariablesAsDocument in interface VariableState
    • getVariablesAsDocument

      public org.agrona.DirectBuffer getVariablesAsDocument(long scopeKey, Collection<org.agrona.DirectBuffer> names)
      Specified by:
      getVariablesAsDocument in interface VariableState
    • getVariablesLocalAsDocument

      public org.agrona.DirectBuffer getVariablesLocalAsDocument(long scopeKey)
      Specified by:
      getVariablesLocalAsDocument in interface VariableState
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface VariableState
    • getVariablesLocal

      public List<VariableState.Variable> getVariablesLocal(long scopeKey)
      Description copied from interface: VariableState
      Returns a list of all variables at the given scope key.

      This method differs from most other methods on this interface in that it does not traverse the scope hierarchy. It only returns variables that are directly stored at the given scope key.

      Specified by:
      getVariablesLocal in interface VariableState
      Parameters:
      scopeKey - the scope key to get the variables for
      Returns:
      a list of all variables at the given scope key
    • getVariableInstanceLocal

      public VariableInstance getVariableInstanceLocal(long scopeKey, org.agrona.DirectBuffer name)
      Specified by:
      getVariableInstanceLocal in interface VariableState
    • getParentScopeKey

      public long getParentScopeKey(long childScopeKey)
      Specified by:
      getParentScopeKey in interface VariableState
      Returns:
      returns the parent scope key of the given childScopeKey, or VariableState.NO_PARENT