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.