Infinispan HotRod C++ Client 9.2.0.Final
Loading...
Searching...
No Matches
TransactionManager.h
Go to the documentation of this file.
1/*
2 * TransactionManager.h
3 *
4 * Created on: Jul 3, 2018
5 * Author: rigazilla
6 */
7
8#ifndef INCLUDE_INFINISPAN_HOTROD_TRANSACTIONMANAGER_H_
9#define INCLUDE_INFINISPAN_HOTROD_TRANSACTIONMANAGER_H_
10
12#include <vector>
13#include <memory>
14#include <thread>
15#include <map>
16#include <string>
17namespace infinispan {
18namespace hotrod {
19
20class Transaction;
21enum class TransactionRemoteStatus : unsigned int;
26public:
28 /***
29 * Start a transaction on this thread. All the caches of all RemoteCacheManager
30 * will be involved
31 */
33 /***
34 * Commit this transaction on the remote server
35 */
37 /***
38 * Rollback this transaction on the remote server
39 */
41 /***
42 * Suspend the current transaction. Not Implemented
43 */
44 // HR_EXTERN void suspend();
45 /***
46 * Resume the suspended current transaction. Not Implemented
47 */
48 // HR_EXTERN void resume();
49 /***
50 * Get the UUID of this transaction manager
51 */
52 const std::vector<char>& getUuid() const { return UUID; }
53 HR_EXTERN std::shared_ptr<Transaction> getCurrentTransaction();
54private:
55 std::map<std::thread::id, std::shared_ptr<Transaction> > currentTransactions;
56 std::vector<char> UUID;
57
58 std::vector<char> generateV4UUID();
59 void throwExceptionOnIllegalState(const std::string& state, const std::string& action);
60 HR_EXTERN TransactionRemoteStatus remotePrepareCommit(Transaction& t);
61 HR_EXTERN void cleanUpCurrentTransaction();
62 HR_EXTERN void remoteCommit(Transaction& t);
63 HR_EXTERN void remoteRollback(Transaction& t);
64 HR_EXTERN void setRollbackOnly();
65};
66
71public:
72 /***
73 * This provides the default instance of the transaction manager.
74 * Used only internally for now
75 */
77 static TransactionManager the_transaction_manager;
78 return the_transaction_manager;
79 }
80};
81
82}
83}
84
85#endif /* INCLUDE_INFINISPAN_HOTROD_TRANSACTIONMANAGER_H_ */
#define HR_EXTERN
Definition: ImportExport.h:35
Definition: TransactionManager.h:70
static TransactionManager & lookup()
Definition: TransactionManager.h:76
Definition: TransactionManager.h:25
const std::vector< char > & getUuid() const
Definition: TransactionManager.h:52
HR_EXTERN std::shared_ptr< Transaction > getCurrentTransaction()
Definition: Transactions.h:130
TransactionRemoteStatus
Definition: Transactions.h:58
Definition: AuthenticationConfiguration.h:10