ejpp
Embedded JSON Database engine for C++11/14
|
View on GitHub
Represents an EJDB transaction. More...
#include <ejdb.hpp>
Public Member Functions | |
bool | abort () noexcept |
Aborts a transaction. More... | |
bool | commit () noexcept |
Commits a transaction. More... | |
bool | in_transaction () const noexcept |
Returns whether a transaction is in progress. More... | |
operator bool () const noexcept | |
Returns whether a transaction is in progress. More... | |
bool | start () noexcept |
Starts a transaction. More... | |
Friends | |
struct | collection |
struct | unique_transaction |
Represents an EJDB transaction.
A transaction is a series of operations that will either be completed all at once or not at all.
A collection cannot have more than one transaction at a time. A transaction must be committed or aborted before another can start. Transactions cannot be nested.
A transaction has no effect on the lifetimes of a parent db or collection object, only references to a transaction_t can be obtained by users.
Although none of the member functions throw, it is not exception-safe to use this class directly for transaction functionality.
|
noexcept |
Aborts a transaction.
Abandons all changes made to the associated collection after a call to transaction_t::start.
Parent db object may have a related error code (via db::error) on failure.
|
noexcept |
Commits a transaction.
Commits all changes made to the associated collection after a call to transaction_t::start.
Parent db object may have a related error code (via db::error) on failure.
|
noexcept |
Returns whether a transaction is in progress.
|
explicitnoexcept |
Returns whether a transaction is in progress.
|
noexcept |
Starts a transaction.
Any operation performed on the associated collection after a successful call will be part of the transaction.
Must be accompanied by a call to transaction_t::commit or transaction_t::abort in order to end a transaction.
Parent db object may have a related error code (via db::error) on failure.