update<T extends Object> abstract method
- @experimental
- required Key key,
- required Decoder<
T?> decoder, - required Transformer<
T?> transformer, - required Encoder<
T?> encoder, - Options? options,
Read–modify–write
.
Updates the data transactionally in an atomic read-modify-write operation.
All operations are serialized, and the transformer
can perform asynchronous computations
such as RPCs, database queries, API calls, etc.
The future completes when the data has been persisted durably to disk. If the transform or write to disk fails, the transaction is aborted and the error is rethrown.
When calling this, logic will be executed in the following order:
- Read raw value by
key
, then decode it withdecoder
. - Transform the decoded value with
transformer
. - Encode the transformed value with
encoder
. - Finally, save encoded value to persistent storage.
Implementation
@experimental
Future<void> update<T extends Object>({
required Key key,
required Decoder<T?> decoder,
required Transformer<T?> transformer,
required Encoder<T?> encoder,
Options? options,
});