C++ · Transactions

Transactions

#include <ustore/db.hpp>#include <ustore/types.hpp> 1.0.0-rc.1 · d6d40961

API

Types

transaction_tA transaction, which owns its handle and serves one call at a time.
db.hpp:623 ↗
class transaction_t

It never commits on destruction, never copies, and holds its database open until destroyed, so it may outlive its database_t.

read_stamp_tThe stamp a transaction or a snapshot reads at, which a commit validates against.
types.hpp:191 ↗
enum read_stamp_t
commit_stamp_tA commit's position in commit order, visible to every snapshot reading at or above it.
types.hpp:194 ↗
enum commit_stamp_t
Classtransaction_ref_tA transaction, as the calls on one executor see it, without owning either.9
db.hpp:502 ↗
class transaction_ref_t

Batched writes are buffered in the layout the engine prefers until the commit, so a transaction also saves preprocessing.

transaction_ref_t
db.hpp:507 ↗
transaction_ref_t() noexcept=default;
transaction_ref_t(receiver_t receiver) noexcept;
onThe same transaction, running every call on executor.
db.hpp:515 ↗
transaction_ref_t on(ustore_executor_t executor) const noexcept;
deferredThe same transaction, whose verbs submit to executor and answer deferred calls.
db.hpp:520 ↗
deferred_transaction_t deferred(
    ustore_executor_t executor) const noexcept;
containsWhether a collection named name exists at the head.
db.hpp:541 ↗
expected<bool> contains(std::string_view name) noexcept;
findOpens a view of one collection that follows this transaction.
db.hpp:550 ↗
template <typename collection_type_ = blobs_collection_t>
expected<collection_type_> find(std::string_view name) noexcept;
resetOpens the transaction, or clears it for reuse, keeping its memory and starting a new generation.
db.hpp:557 ↗
status_t reset() noexcept;
stageStages the transaction as the first phase of a two-phase commit, answering the stamp it reads at.
db.hpp:570 ↗
expected<read_stamp_t> stage() noexcept;
rollbackWithdraws a stage, releasing what it claimed while keeping the reads and writes, so the transaction can stage or commit again.
db.hpp:587 ↗
status_t rollback() noexcept;
commitCommits every update of the transaction, or none of them if any one fails, answering the commit's position in commit order.
db.hpp:604 ↗
expected<commit_stamp_t> commit(
    ustore_durability_t durability = ustore_durability_buffered_k) noexcept;

Parameters

durabilityinWhether the call returns only after the data reaches the disk.