updateValue method

  1. @override
Future<NodeValue> updateValue(
  1. NodeValue value
)
override

Update a specific value of the node.

@param value the key to be updated @return the requested value or null if not found @throws StorageException if the storage backend encounters a problem

Implementation

@override
Future<NodeValue> updateValue(NodeValue value) async {
  await _init();
  NodeValue? ret = await _getValue(value.key);
  if (ret == null) {
    throw StorageException(
        'Value ' + value.key + ' not found in node ' + (name));
  }
  // TODO(unassigned): check if a modification took place and update timestamp only in that case
  lastModified = ExtendedTimestamp.now(false);
  value.lastModified = lastModified;
  _values[value.key] = value;
  return ret;
}