ParaOrderedDataStore.UpdateData

Declaration

ok, value info = UpdateData(string key, function updateFunction)

Parameters

Parameter NameParameter Description
keystringKey of the data to be updated. Only numeric type is supported.
updateFunctionfunctionFunction used for updating the data.

Return Values

Response NameResponse TypeDescription
okintIf the value is 0, the value assignment operation is successful. Otherwise, the operation fails.
valuedouble or stringIf the operation is successful, the updated value is returned. Otherwise, an error message is returned.
infoParaOrderedDataInfoIf the operation is successful, the detailed information (such as version and metadata) is returned.

Description

Updates data with a function.

Updates the data corresponding to a key through a callback function. The callback function gets the current value and returns the new value based on the defined logic. The callback function cannot be paused once executed.

Callback Function Declaration

newValue = updateFunction(double currentValue, ParaOrderedDataInfo info)

Callback Function Parameters

Parameter NameResponse TypeParameter Description
currentValuedoubleCurrent value.
infoParaOrderedDataInfoAdditional information about the current value.

Callback Function Response Declaration

Response NameResponse TypeDescription
newValuedoubleExpected new value.