| Apache Ignite C++

transaction.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
23 #ifndef _IGNITE_TRANSACTIONS_TRANSACTION
24 #define _IGNITE_TRANSACTIONS_TRANSACTION
25
26 #include <ignite/common/concurrent.h>
27
28 #include "ignite/impl/transactions/transaction_impl.h"
29 #include "ignite/transactions/transaction_consts.h"
30
31 namespace ignite
32 {
33 namespace transactions
34 {
47 class IGNITE_FRIEND_EXPORT Transaction
48 {
49 public:
57 Transaction(common::concurrent::SharedPointer<impl::transactions::TransactionImpl> impl);
58
64 Transaction(const Transaction& other);
65
72 Transaction& operator=(const Transaction& other);
73
77 ~Transaction();
78
86 void Commit();
87
97 void Commit(IgniteError& err);
98
106 void Rollback();
107
117 void Rollback(IgniteError& err);
118
126 void Close();
127
137 void Close(IgniteError& err);
138
150 void SetRollbackOnly();
151
165 void SetRollbackOnly(IgniteError& err);
166
178 bool IsRollbackOnly();
179
194 bool IsRollbackOnly(IgniteError& err);
195
205 TransactionState::Type GetState();
206
217 TransactionState::Type GetState(IgniteError& err);
218
226 TransactionConcurrency::Type GetConcurrency() const
227 {
228 return static_cast<TransactionConcurrency::Type>(impl.Get()->GetConcurrency());
229 }
230
238 TransactionIsolation::Type GetIsolation() const
239 {
240 return static_cast<TransactionIsolation::Type>(impl.Get()->GetIsolation());
241 }
242
250 int64_t GetTimeout() const
251 {
252 return impl.Get()->GetTimeout();
253 }
254
266 bool IsValid() const
267 {
268 return impl.IsValid();
269 }
270
271 private:
273 common::concurrent::SharedPointer<impl::transactions::TransactionImpl> impl;
274 };
275 }
276 }
277
278 #endif //_IGNITE_TRANSACTIONS_TRANSACTION
ignite::transactions::TransactionState::Type
Type
Definition: transaction_consts.h:120
ignite::transactions::Transaction::GetConcurrency
TransactionConcurrency::Type GetConcurrency() const
Get concurrency.
Definition: transaction.h:226
ignite::transactions::Transaction
Ignite cache transaction.
Definition: transaction.h:47
ignite::transactions::Transaction::GetIsolation
TransactionIsolation::Type GetIsolation() const
Get isolation.
Definition: transaction.h:238
ignite::transactions::Transaction::GetTimeout
int64_t GetTimeout() const
Get timeout.
Definition: transaction.h:250
transaction_consts.h
Declares Transaction-related enumerations.
ignite::IgniteError
Ignite error information.
Definition: ignite_error.h:94
ignite::transactions::Transaction::IsValid
bool IsValid() const
Check if the instance is valid and can be used.
Definition: transaction.h:266
ignite::transactions::TransactionIsolation::Type
Type
Definition: transaction_consts.h:73
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::transactions::TransactionConcurrency::Type
Type
Definition: transaction_consts.h:35