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 /
18 rasdaman 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 
33 class r_OId;
34 class r_Database;
35 class r_Ref_Any;
36 template <typename T>
37 class r_Ref;
38 
50 {
51 public:
54  {
59  };
60 
62  enum r_TAMode
63  {
66  };
67 
70  r_Transaction(r_Database *db = NULL);
71 
74 
76  void begin(r_TAMode mode = read_write);
88  void commit();
105  void abort();
107 
109  r_TAStatus get_status() const;
110 
112  r_TAMode get_mode() const;
113 
114  //@Man: Methods and types for internal use only:
116 
120 
122  r_Ref_Any load_object(const r_OId &oid);
123 
125  void add_object_list(GenRefType type, void *ref);
126 
130  void setDatabase(r_Database *database);
131 
134 
136 
137 
138 private:
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
r_Transaction::get_mode
r_TAMode get_mode() const
returns current mode
r_Transaction::begin
void begin(r_TAMode mode=read_write)
start the transaction
r_Transaction::abort
void abort()
The transaction is committed and changes are made persistent in the database.
r_Transaction::setDatabase
void setDatabase(r_Database *database)
sets the database reference that this transaction is using.
r_Transaction::active
@ active
Definition: transaction.hh:55
r_Ref_Any
The class r_Ref_Any is defined to support a reference to any type.
Definition: ref.hh:64
r_Transaction::add_object_list
void add_object_list(GenRefType type, void *ref)
adds a non-r_Object to the list of persistent objects
r_Transaction::aborting
@ aborting
Definition: transaction.hh:58
r_Transaction::actual_transaction
static r_Transaction * actual_transaction
store a pointer to the actual transaction
Definition: transaction.hh:119
r_Transaction::read_only
@ read_only
Definition: transaction.hh:65
r_Ref
References of type r_Ref in many respects behave like C++ pointers but provide an additional mechanis...
Definition: collection.hh:196
r_Transaction::inactive
@ inactive
Definition: transaction.hh:56
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::read_write
@ read_write
Definition: transaction.hh:64
r_Transaction::r_TAStatus
r_TAStatus
possible states of the transaction
Definition: transaction.hh:53
r_Transaction::get_status
r_TAStatus get_status() const
returns the current state
set.hh
r_Set
The class implements a set container.
Definition: oqlquery.hh:31
r_Transaction
Transactions can be started, committed, aborted, and checkpointed.
Definition: transaction.hh:49
r_Transaction::comiting
@ comiting
Definition: transaction.hh:57
r_Transaction::~r_Transaction
~r_Transaction()
destructor, an active transaction is aborted
r_Transaction::r_TAMode
r_TAMode
possible transaction modes
Definition: transaction.hh:62
GenRefType
GenRefType
possible non-r_Object values maintained by the transaction
Definition: genreftype.hh:27
r_Object
Through inheritance of this class, the type definer specifies that the subclass is capable of having ...
Definition: object.hh:61
r_Transaction::getDatabase
r_Database * getDatabase()
returns the database used by this transaction
r_Transaction::load_object
r_Ref_Any load_object(const r_OId &oid)
load an object (internal use only)
object.hh
r_Database
A database object must be instantiated and opened before starting any transaction which uses the data...
Definition: database.hh:59
r_Transaction::commit
void commit()
By default, a transaction is started in write mode.
genreftype.hh
r_OId
Class r_OId represents an object identifier.
Definition: oid.hh:38