rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
Public Types | Public Member Functions | Static Public Attributes | List of all members
r_Transaction Class Reference

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. More...
 
 ~r_Transaction ()
 destructor, an active transaction is aborted More...
 
void begin (r_TAMode mode=read_write)
 start the transaction More...
 
void commit ()
 By default, a transaction is started in write mode. More...
 
void abort ()
 The transaction is committed and changes are made persistent in the database. More...
 
r_TAStatus get_status () const
 returns the current state More...
 
r_TAMode get_mode () const
 returns current mode More...
 
r_Ref_Any load_object (const r_OId &oid)
 load an object (internal use only) More...
 
void add_object_list (GenRefType type, void *ref)
 adds a non-r_Object to the list of persistent objects More...
 
void setDatabase (r_Database *database)
 sets the database reference that this transaction is using. More...
 
r_DatabasegetDatabase ()
 returns the database used by this transaction More...
 

Static Public Attributes

static r_Transactionactual_transaction
 store a pointer to the actual transaction More...
 

Detailed Description

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.

Member Enumeration Documentation

◆ r_TAMode

possible transaction modes

Enumerator
read_write 
read_only 

◆ r_TAStatus

possible states of the transaction

Enumerator
active 
inactive 
comiting 
aborting 

Constructor & Destructor Documentation

◆ r_Transaction()

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::~r_Transaction ( )

destructor, an active transaction is aborted

Member Function Documentation

◆ abort()

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

◆ add_object_list()

void r_Transaction::add_object_list ( GenRefType  type,
void *  ref 
)

adds a non-r_Object to the list of persistent objects

◆ begin()

void r_Transaction::begin ( r_TAMode  mode = read_write)

start the transaction

◆ commit()

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

◆ get_mode()

r_TAMode r_Transaction::get_mode ( ) const

returns current mode

◆ get_status()

r_TAStatus r_Transaction::get_status ( ) const

returns the current state

◆ getDatabase()

r_Database* r_Transaction::getDatabase ( )

returns the database used by this transaction

◆ load_object()

r_Ref_Any r_Transaction::load_object ( const r_OId oid)

load an object (internal use only)

◆ setDatabase()

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

Member Data Documentation

◆ actual_transaction

r_Transaction* r_Transaction::actual_transaction
static

store a pointer to the actual transaction


The documentation for this class was generated from the following file: