Module transactional

Source
Expand description

Provides functionality around the transaction storage.

Transactional storage provides functionality to run an entire code block in a storage transaction. This means that either the entire changes to the storage are committed or everything is thrown away. This simplifies the writing of functionality that may bail at any point of operation. Otherwise you would need to first verify all storage accesses and then do the storage modifications.

with_transaction provides a way to run a given closure in a transactional context.

Constants§

TRANSACTIONAL_LIMIT
The maximum number of nested layers.
TRANSACTION_LEVEL_KEY
The key that is holds the current number of active layers.

Functions§

in_storage_layer
Execute the supplied function, ensuring we are at least in one storage layer.
is_transactional
Check if the current call is within a transactional layer.
with_storage_layer
Execute the supplied function, adding a new storage layer.
with_transaction
Execute the supplied function in a new storage transaction.
with_transaction_opaque_err
Same as with_transaction but casts any internal error to ().
with_transaction_unchecked
Same as with_transaction but without a limit check on nested transactional layers.

Type Aliases§

Layer
The type that is being used to store the current number of active layers.