-
#include "tensorstore/transaction.h"
- enum tensorstore::TransactionMode;
Specifies the transaction mode.
- enumerator no_transaction_mode = 0;¶
Indicates non-transactional semantics. This is the default for operations performed without an explicit transaction.
Non-transactional operations have the following properties:
Atomicity is NOT guaranteed
Consistency is guaranteed for most operations, with a few exceptions: resize under certain conditions, and creating a TensorStore with
OpenMode::delete_existing
under certain conditions.Read and write isolation are NOT guaranteed
Durability is guaranteed.
- enumerator isolated = 1;¶
Writes are isolated and will not be visible to other readers until the transaction is committed.
Isolated transactions have the following properties:
Atomicity is NOT guaranteed
Consistency has the same guarantees as for
no_transaction_mode
.Write isolation is guaranteed prior to commit. Once commit starts, isolation is not guaranteed. Read isolation is not guaranteed in general, but metadata operations do guarantee read isolation/consistency.
Durability is guaranteed.
- enumerator atomic_isolated = 3;¶
In addition to the properties of
isolated
, writes are guaranteed to be committed atomically. If an operation cannot satisfy this guarantee, it returns an error (immediately while the transaction is being prepared).Atomic-isolated transactions have the following properties:
Atomicity is guaranteed
Consistency is guaranteed
Write isolation is guaranteed. Read isolation is not guaranteed, but metadata operations do guarantee read isolation/consistency.
Durability is guaranteed.
- enumerator repeatable_read = 4;¶
Repeated reads are guaranteed to return the same result. If a concurrent change occurs, the transaction will fail to commit. Whether concurrent changes lead to transaction failure prior to commit is unspecified.
Spurious errors due to concurrent writes to data that was not read (but may be “nearby” data that was read) may occur.
Related Functions¶
-
constexpr TransactionMode
tensorstore::operator|(TransactionMode a, TransactionMode b); -
constexpr TransactionMode&
tensorstore::operator|=(TransactionMode& a, TransactionMode b); Unions the requirements of two transaction modes.
-
std::ostream&
tensorstore::operator<<(std::ostream& os, TransactionMode mode); Prints a string representation of the transaction mode to an
std::ostream
.