updateData

abstract suspend fun updateData(transform: suspend (t: T) -> T): T(source)

Updates the data transactionally in an atomic read-modify-write operation. All operations are serialized, and the transform itself is a coroutine so it can perform heavy work such as RPCs.

The coroutine completes when the data has been persisted durably to disk (after which data will reflect the update). If the transform or write to disk fails, the transaction is aborted and an exception is thrown.

Return

the snapshot returned by the transform

Throws

when an exception is encountered when writing data to disk

Exception

when thrown by the transform function