rasdaman client API 10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
transaction.hh
Go to the documentation of this file.
1/*
2* This file is part of rasdaman community.
3*
4* Rasdaman community is free software: you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation, either version 3 of the License, or
7* (at your option) any later version.
8*
9* Rasdaman community is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16*
17* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18rasdaman GmbH.
19*
20* For more information please see <http://www.rasdaman.org>
21* or contact Peter Baumann via <baumann@rasdaman.com>.
22*/
23
24//@ManMemo: Module: {\bf rasodmg}
25
26#ifndef D_TRANSACTION_HH
27#define D_TRANSACTION_HH
28
29#include "rasodmg/set.hh"
30#include "rasodmg/object.hh"
31#include "rasodmg/genreftype.hh"
32
33class r_OId;
34class r_Database;
35class r_Ref_Any;
36template <typename T>
37class r_Ref;
38
50{
51public:
60
67
71
74
89 void commit();
106 void abort();
107
110
113
114 //@Man: Methods and types for internal use only:
116
117
120
123
125 void add_object_list(GenRefType type, void *ref);
126
130 void setDatabase(r_Database *database);
131
134
136
137
138private:
140 void add_object_list(const r_Ref<r_Object> &);
141
143 r_TAStatus ta_state;
144
146 r_TAMode ta_mode;
147
149 r_Set<r_Ref<r_Object>> object_list;
150
152 r_Set<GenRefElement *> non_object_list;
153
154 friend class r_Object;
155
157 r_Database *database;
158};
159
160#endif
A database object must be instantiated and opened before starting any transaction which uses the data...
Definition database.hh:60
Class r_OId represents an object identifier.
Definition oid.hh:39
Through inheritance of this class, the type definer specifies that the subclass is capable of having ...
Definition object.hh:62
The class r_Ref_Any is defined to support a reference to any type.
Definition ref.hh:65
References of type r_Ref in many respects behave like C++ pointers but provide an additional mechanis...
Definition ref.hh:198
The class implements a set container.
Definition set.hh:42
Transactions can be started, committed, aborted, and checkpointed.
Definition transaction.hh:50
r_TAStatus get_status() const
returns the current state
r_TAMode
possible transaction modes
Definition transaction.hh:63
@ read_write
Definition transaction.hh:64
@ read_only
Definition transaction.hh:65
void begin(r_TAMode mode=read_write)
start the transaction
r_TAMode get_mode() const
returns current mode
r_Ref_Any load_object(const r_OId &oid)
load an object (internal use only)
static r_Transaction * actual_transaction
store a pointer to the actual transaction
Definition transaction.hh:119
~r_Transaction()
destructor, an active transaction is aborted
void abort()
The transaction is committed and changes are made persistent in the database.
void commit()
By default, a transaction is started in write mode.
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_TAStatus
possible states of the transaction
Definition transaction.hh:54
@ inactive
Definition transaction.hh:56
@ aborting
Definition transaction.hh:58
@ comiting
Definition transaction.hh:57
@ active
Definition transaction.hh:55
r_Transaction(r_Database *db=NULL)
create a new transaction object; if the db object is not provided, this class not thread-safe.
r_Database * getDatabase()
returns the database used by this transaction
GenRefType
possible non-r_Object values maintained by the transaction
Definition genreftype.hh:28