Class DbVariableState
java.lang.Object
io.camunda.zeebe.engine.state.variable.DbVariableState
- All Implemented Interfaces:
VariableState
,MutableVariableState
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.zeebe.engine.state.immutable.VariableState
VariableState.Variable
-
Field Summary
Fields inherited from interface io.camunda.zeebe.engine.state.immutable.VariableState
NO_PARENT
-
Constructor Summary
ConstructorsConstructorDescriptionDbVariableState
(ZeebeDb<ZbColumnFamilies> zeebeDb, TransactionContext transactionContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
createScope
(long childKey, long parentKey) long
getParentScopeKey
(long childScopeKey) org.agrona.DirectBuffer
getVariable
(long scopeKey, org.agrona.DirectBuffer name) Find the variable with the given name.org.agrona.DirectBuffer
getVariable
(long scopeKey, org.agrona.DirectBuffer name, int nameOffset, int nameLength) Find the variable with the given name.getVariableInstanceLocal
(long scopeKey, org.agrona.DirectBuffer name) org.agrona.DirectBuffer
getVariableLocal
(long scopeKey, org.agrona.DirectBuffer name) org.agrona.DirectBuffer
getVariablesAsDocument
(long scopeKey) org.agrona.DirectBuffer
getVariablesAsDocument
(long scopeKey, Collection<org.agrona.DirectBuffer> names) getVariablesLocal
(long scopeKey) Returns a list of all variables at the given scope key.org.agrona.DirectBuffer
getVariablesLocalAsDocument
(long scopeKey) boolean
isEmpty()
void
removeAllVariables
(long scopeKey) void
removeScope
(long scopeKey) void
setVariableLocal
(long key, long scopeKey, long processDefinitionKey, org.agrona.DirectBuffer name, int nameOffset, int nameLength, org.agrona.DirectBuffer value, int valueOffset, int valueLength) Creates or updates the variable withname
within the given scope withscopeKey
, setting its value to the givenvalue
.void
setVariableLocal
(long key, long scopeKey, long processDefinitionKey, org.agrona.DirectBuffer name, org.agrona.DirectBuffer value) Creates or updates the variable withname
within the given scope withscopeKey
, setting its value to the givenvalue
.
-
Constructor Details
-
DbVariableState
-
-
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 withname
within the given scope withscopeKey
, setting its value to the givenvalue
.This method is expected to be called directly ONLY from an
EventApplier
or from tests.- Specified by:
setVariableLocal
in interfaceMutableVariableState
- Parameters:
key
- the variable keyscopeKey
- the local scope of the variableprocessDefinitionKey
- the associated process key, mostly for monitoring purposesname
- the name of the variablevalue
- 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 withname
within the given scope withscopeKey
, setting its value to the givenvalue
.This method is expected to be called directly ONLY from an
EventApplier
or from tests.- Specified by:
setVariableLocal
in interfaceMutableVariableState
- Parameters:
key
- the variable keyscopeKey
- the local scope of the variableprocessDefinitionKey
- the associated process key, mostly for monitoring purposesname
- the name of the variablenameOffset
- offset at which the name starts in thename
buffernameLength
- length of the variable name in thename
buffervalue
- the value of the variable (MsgPack encoded)valueOffset
- offset at which the value starts in thevalue
buffervalueLength
- length of the variable value in thevalue
buffer
-
createScope
public void createScope(long childKey, long parentKey) - Specified by:
createScope
in interfaceMutableVariableState
-
removeScope
public void removeScope(long scopeKey) - Specified by:
removeScope
in interfaceMutableVariableState
-
removeAllVariables
public void removeAllVariables(long scopeKey) - Specified by:
removeAllVariables
in interfaceMutableVariableState
-
getVariableLocal
public org.agrona.DirectBuffer getVariableLocal(long scopeKey, org.agrona.DirectBuffer name) - Specified by:
getVariableLocal
in interfaceVariableState
-
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 interfaceVariableState
- Parameters:
scopeKey
- the key of the variable scope to start fromname
- 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 interfaceVariableState
- Parameters:
scopeKey
- the key of the variable scope to start fromname
- the buffer that contains the name of the variablenameOffset
- the offset of name in the buffernameLength
- 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 interfaceVariableState
-
getVariablesAsDocument
public org.agrona.DirectBuffer getVariablesAsDocument(long scopeKey, Collection<org.agrona.DirectBuffer> names) - Specified by:
getVariablesAsDocument
in interfaceVariableState
-
getVariablesLocalAsDocument
public org.agrona.DirectBuffer getVariablesLocalAsDocument(long scopeKey) - Specified by:
getVariablesLocalAsDocument
in interfaceVariableState
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceVariableState
-
getVariablesLocal
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 interfaceVariableState
- Parameters:
scopeKey
- the scope key to get the variables for- Returns:
- a list of all variables at the given scope key
-
getVariableInstanceLocal
- Specified by:
getVariableInstanceLocal
in interfaceVariableState
-
getParentScopeKey
public long getParentScopeKey(long childScopeKey) - Specified by:
getParentScopeKey
in interfaceVariableState
- Returns:
- returns the parent scope key of the given
childScopeKey
, orVariableState.NO_PARENT
-