-
#include "tensorstore/transaction.h"
- class tensorstore::Transaction;
Shared handle to a transaction.
Types¶
- struct no_transaction_t;
Special type that indicates a null transaction.
Constructors¶
- constexpr Transaction(no_transaction_t);
Creates a null transaction.
- explicit Transaction(TransactionMode mode);
Creates a new transaction with the specified mode.
Methods¶
- TransactionMode mode() const;
Returns the transaction mode.
- bool atomic() const;
Returns true if this transaction guarantees atomicity.
- bool aborted() const;
Returns
true
if the transaction has been aborted.
- bool commit_started() const;
Returns
true
if the transaction commit has started.
- void Abort() const;
Aborts the transaction (has no effect if already aborted or committed).
- absl::Status Commit() const;
Synchronously commits. Blocks until the commit completes successfully or with an error.
- Future<const void> CommitAsync() const;
Commits the transaction (has no effect if already committed or aborted).
- void Barrier() const;
Creates a write barrier. Guarantees that subsequent writes are not committed before any prior write.
- Future<const void> future() const;
Returns a
Future
that becomes ready when the transaction is committed or aborted. Forcing the returnedFuture
is equivalent to callingCommitAsync
.
- size_t total_bytes() const;
Returns an estimate of the number of bytes of memory currently consumed by the transaction.
Friend functions¶
- friend bool operator==(const Transaction& a, const Transaction& b);
- friend bool operator!=(const Transaction& a, const Transaction& b);
- friend bool operator==(const Transaction& a, no_transaction_t b);
- friend bool operator==(no_transaction_t a, const Transaction& b);
- friend bool operator!=(const Transaction& a, no_transaction_t b);
- friend bool operator!=(no_transaction_t a, const Transaction& b);
Checks if
a
andb
refer to the same transaction state, or are both null.
Related Types¶
- enum tensorstore::TransactionMode;
Specifies the transaction mode.
Related Constants¶
-
constexpr const Transaction::no_transaction_t
tensorstore::no_transaction = no_transaction{}; Special value that indicates non-transactional semantics.