Transaction

class Transaction


The Transaction class encapsulates the functionality needed to perform a transaction on the data at a location. To run a transaction, provide a Handler to runTransaction. That handler will be passed the current data at the location, and must return a Result. A Result can be created using either success or abort.

Summary

Nested types

An object implementing this interface is used to run a transaction, and will be notified of the results of the transaction.

Instances of this class represent the desired outcome of a single run of a Handler's doTransaction method.

Public constructors

Public functions

java-static Transaction.Result
java-static Transaction.Result
success(resultData: MutableData)

Public constructors

Transaction

Transaction()

Public functions

abort

java-static fun abort(): Transaction.Result
Returns
Transaction.Result

A Result that aborts the transaction

success

java-static fun success(resultData: MutableData): Transaction.Result
Parameters
resultData: MutableData

The desired data at the location

Returns
Transaction.Result

A Result indicating the new data to be stored at the location