Apache Geode Native C++ Reference 1.15.0
CacheTransactionManager.hpp
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
18#pragma once
19
20#ifndef GEODE_CACHETRANSACTIONMANAGER_H_
21#define GEODE_CACHETRANSACTIONMANAGER_H_
22
23//#### Warning: DO NOT directly include Region.hpp, include Cache.hpp instead.
24
25#include <chrono>
26#include <memory>
27
28#include "TransactionId.hpp"
29#include "internal/geode_globals.hpp"
30
31namespace apache {
32namespace geode {
33namespace client {
34
39class APACHE_GEODE_EXPORT CacheTransactionManager {
40 public:
48 virtual void begin() = 0;
49
80 virtual void prepare() = 0;
81
109 virtual void commit() = 0;
110
120 virtual void rollback() = 0;
121
131 virtual TransactionId& suspend() = 0;
132
145 virtual void resume(TransactionId& transactionId) = 0;
146
157 virtual bool isSuspended(TransactionId& transactionId) = 0;
158
176 virtual bool tryResume(TransactionId& transactionId) = 0;
177
199 virtual bool tryResume(TransactionId& transactionId,
200 std::chrono::milliseconds waitTime) = 0;
201
213 virtual bool exists(TransactionId& transactionId) = 0;
214
222
229 virtual bool exists() = 0;
230
231 protected:
233 virtual ~CacheTransactionManager();
234};
235} // namespace client
236} // namespace geode
237} // namespace apache
238
239#endif // GEODE_CACHETRANSACTIONMANAGER_H_
An interface for objects who perform transaction management.
Definition: CacheTransactionManager.hpp:39
virtual TransactionId & suspend()=0
Suspends the transaction on the current thread.
virtual void begin()=0
Creates a new transaction and associates it with the current thread.
virtual bool exists(TransactionId &transactionId)=0
Reports the existence of a transaction for the given transactionId.
virtual TransactionId & getTransactionId()=0
Returns the transaction identifier for the current thread.
virtual bool isSuspended(TransactionId &transactionId)=0
This method can be used to determine if a transaction with the given transaction identifier is curren...
virtual bool exists()=0
Reports the existence of a Transaction for this thread.
virtual void resume(TransactionId &transactionId)=0
On the current thread, resumes a transaction that was previously suspended using suspend().
virtual void commit()=0
Commit the transaction associated with the current thread.
virtual bool tryResume(TransactionId &transactionId, std::chrono::milliseconds waitTime)=0
On the current thread, resumes a transaction that was previously suspended using suspend(),...
virtual bool tryResume(TransactionId &transactionId)=0
On the current thread, resumes a transaction that was previously suspended using suspend().
virtual void prepare()=0
Performs prepare during 2 phase commit completion, for the transaction associated with the current th...
virtual void rollback()=0
Roll back the transaction associated with the current thread.
The TransactionId interface is a "marker" interface that represents a unique Geode transaction.
Definition: TransactionId.hpp:36

Apache Geode C++ Cache API Documentation