![]() |
RDB 2
|
Manage point cloud transactions. More...
#include <transactions.hpp>
Public Member Functions | |
Transactions (riegl::rdb::PointcloudData *pointcloud) | |
Constructor. More... | |
Transaction::ID | begin (const std::string &title, const std::string &agent, const std::string &comments="", const std::string &settings="") |
Create new transaction. More... | |
void | commit (Progress progress=nullptr, void *userdata=nullptr, const uint32_t signature=0, const uint32_t key_size=0, const void *const key_data=nullptr) |
Commit current transaction. More... | |
template<typename Callable > | |
void | commit (Callable &&progress, const uint32_t signature=0, const uint32_t key_size=0, const void *const key_data=nullptr) |
Commit current transaction. More... | |
template<typename Receiver > | |
void | commit (void(Receiver::*progress)(uint8_t), Receiver &receiver, const uint32_t signature=0, const uint32_t key_size=0, const void *const key_data=nullptr) |
Commit current transaction. More... | |
template<typename Receiver > | |
void | commit (void(Receiver::*progress)(uint8_t) const, const Receiver &receiver, const uint32_t signature=0, const uint32_t key_size=0, const void *const key_data=nullptr) |
Commit current transaction. More... | |
void | rollback () |
Abort current transaction. More... | |
std::vector< Transaction::ID > | list () const |
Get list of transactions. More... | |
Transaction::ID | current () const |
ID of current transaction. More... | |
bool | pending () const |
Check if transaction is pending. More... | |
Transaction | details (const Transaction::ID transaction) const |
Query transaction details. More... | |
void | restore (const Transaction::ID transaction) |
Restore database state. More... | |
Manage point cloud transactions.
Modifying the point cloud database means to execute a transaction.
This class allows to start new transactions (see begin()) and to browse past (already executed) transactions.
Definition at line 64 of file transactions.hpp.
|
explicit |
Constructor.
Transaction::ID riegl::rdb::pointcloud::Transactions::begin | ( | const std::string & | title, |
const std::string & | agent, | ||
const std::string & | comments = "" , |
||
const std::string & | settings = "" |
||
) |
Create new transaction.
Whenever you are going to modify the point cloud, you must create a transaction by using this function. Without a transaction, any function that modifies the point cloud will fail (i.e. it throws an exception).
A transaction automatically locks the database so that other users can query data but can NOT add or modify data. Please note that only one transaction at a time is allowed. If there is already a transaction pending, this function will raise an exception (see Error::TransactionPending).
To finish a transaction either call commit() or rollback().
[in] | title | short description, e.g. "Import" |
[in] | agent | software name, e.g. "rdbimport v1.0" |
[in] | comments | e.g. process details for humans |
[in] | settings | e.g. process settings for software |
|
inline |
Commit current transaction.
Overloaded commit() that takes any callable type as progress callback.
[in] | progress | progress callback function |
[in] | signature | signature method (0: none, 1: default) |
[in] | key_size | signature encryption key size (at least 32 byte) |
[in] | key_data | signature encryption key buffer |
Definition at line 129 of file transactions.hpp.
void riegl::rdb::pointcloud::Transactions::commit | ( | Progress | progress = nullptr , |
void * | userdata = nullptr , |
||
const uint32_t | signature = 0 , |
||
const uint32_t | key_size = 0 , |
||
const void *const | key_data = nullptr |
||
) |
Commit current transaction.
This function commits the current transaction. All changes made by the transaction become visible to others.
[in] | progress | commit progress callback function |
[in] | userdata | progress callback function user data |
[in] | signature | signature method (0: none, 1: default) |
[in] | key_size | signature encryption key size (at least 32 byte) |
[in] | key_data | signature encryption key buffer |
|
inline |
Commit current transaction.
Overloaded commit() that takes a constant progress callback method of a constant object.
[in] | signature | signature method (0: none, 1: default) |
[in] | key_size | signature encryption key size (at least 32 byte) |
[in] | key_data | signature encryption key buffer |
Definition at line 171 of file transactions.hpp.
|
inline |
Commit current transaction.
Overloaded commit() that takes a progress callback method of an object.
[in] | signature | signature method (0: none, 1: default) |
[in] | key_size | signature encryption key size (at least 32 byte) |
[in] | key_data | signature encryption key buffer |
Definition at line 150 of file transactions.hpp.
Transaction::ID riegl::rdb::pointcloud::Transactions::current | ( | ) | const |
ID of current transaction.
This function returns the ID of the current transaction. Usually this is the transaction that was committed at last. However, if restore() is used to return to a previous database state, the current transaction is the restored transaction.
Transaction riegl::rdb::pointcloud::Transactions::details | ( | const Transaction::ID | transaction | ) | const |
Query transaction details.
[in] | transaction | transaction identifier |
std::vector<Transaction::ID> riegl::rdb::pointcloud::Transactions::list | ( | ) | const |
Get list of transactions.
The database keeps a log (journal) of all transactions. This function returns a list of identifiers (IDs) for all recorded transactions.
bool riegl::rdb::pointcloud::Transactions::pending | ( | ) | const |
Check if transaction is pending.
This function checks whether there is a pending transaction that was started by this database instance. This function does not check whether a transaction was started by a different database instance of the current or different thread or process.
void riegl::rdb::pointcloud::Transactions::restore | ( | const Transaction::ID | transaction | ) |
Restore database state.
This function restores the database state that was current at the end of the transaction. Those transactions that were created after the restored transaction remain valid until a new transaction is created. This offers some simple undo/redo functionality.
[in] | transaction | transaction identifier |
void riegl::rdb::pointcloud::Transactions::rollback | ( | ) |
Abort current transaction.
This function rolls back the current transaction and causes all changes made by the transaction to be discarded.