![]() |
rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
|
Transactions can be started, committed, aborted, and checkpointed. More...
#include <transaction.hh>
Public Types | |
| enum | r_TAStatus { active , inactive , comiting , aborting } |
| possible states of the transaction More... | |
| enum | r_TAMode { read_write , read_only } |
| possible transaction modes More... | |
Public Member Functions | |
| r_Transaction (r_Database *db=NULL) | |
| create a new transaction object; if the db object is not provided, this class not thread-safe. | |
| ~r_Transaction () | |
| destructor, an active transaction is aborted | |
| void | begin (r_TAMode mode=read_write) |
| start the transaction | |
| void | commit () |
| By default, a transaction is started in write mode. | |
| void | abort () |
| The transaction is committed and changes are made persistent in the database. | |
| r_TAStatus | get_status () const |
| returns the current state | |
| r_TAMode | get_mode () const |
| returns current mode | |
| r_Ref_Any | load_object (const r_OId &oid) |
| load an object (internal use only) | |
| void | add_object_list (GenRefType type, void *ref) |
| adds a non-r_Object to the list of persistent objects | |
| void | setDatabase (r_Database *database) |
| sets the database reference that this transaction is using. | |
| r_Database * | getDatabase () |
| returns the database used by this transaction | |
Static Public Attributes | |
| static r_Transaction * | actual_transaction |
| store a pointer to the actual transaction | |
Transactions can be started, committed, aborted, and checkpointed.
It is important to note that all access, creation, modification, and deletion of persistent objects must be done within a transaction. Right now, only one transaction can be active at a time.
| r_Transaction::r_Transaction | ( | r_Database * | db = NULL | ) |
create a new transaction object; if the db object is not provided, this class not thread-safe.
| r_Transaction::~r_Transaction | ( | ) |
destructor, an active transaction is aborted
| void r_Transaction::abort | ( | ) |
The transaction is committed and changes are made persistent in the database.
While committing, the following errors can occur:
abort transaction and forget changes within transaction
| void r_Transaction::add_object_list | ( | GenRefType | type, |
| void * | ref | ||
| ) |
adds a non-r_Object to the list of persistent objects
| void r_Transaction::begin | ( | r_TAMode | mode = read_write | ) |
start the transaction
| void r_Transaction::commit | ( | ) |
By default, a transaction is started in write mode.
If the read_only mode is specified, no write operations are allowed within the transaction anymore. If any write operation occurs in read_only mode, the exception r_Error with kind r_Error_TransactionReadOnly will be raised and the transaction will be aborted. In order to achieve maximal performance, read-only transactions should be used whenever posssible, i.e., when no update operations occur within this transaction. commit transaction and make changes persistent
| r_TAMode r_Transaction::get_mode | ( | ) | const |
returns current mode
| r_TAStatus r_Transaction::get_status | ( | ) | const |
returns the current state
| r_Database * r_Transaction::getDatabase | ( | ) |
returns the database used by this transaction
| void r_Transaction::setDatabase | ( | r_Database * | database | ) |
sets the database reference that this transaction is using.
if none is provided the default static database is used NOTE: The setDatabase method should be called before any other operation that uses the database
|
static |
store a pointer to the actual transaction