18#include "hazelcast/client/iqueue.h"
19#include "hazelcast/client/imap.h"
20#include "hazelcast/client/ilist.h"
21#include "hazelcast/client/iset.h"
22#include "hazelcast/client/multi_map.h"
23#include "hazelcast/client/transaction_options.h"
24#include "hazelcast/client/txn/TransactionProxy.h"
25#include "hazelcast/client/transactional_map.h"
26#include "hazelcast/client/exception/protocol_exceptions.h"
27#include "hazelcast/client/transactional_queue.h"
28#include "hazelcast/client/transactional_multi_map.h"
29#include "hazelcast/client/transactional_list.h"
30#include "hazelcast/client/transactional_set.h"
32#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
34#pragma warning(disable : 4251)
39class HAZELCAST_API hash<
std::pair<std::string, std::string>>
42 std::size_t operator()(
43 const std::pair<std::string, std::string>& val)
const noexcept;
51class ClientTransactionManagerServiceImpl;
56class ClientConnectionManagerImpl;
76 spi::impl::ClientTransactionManagerServiceImpl& transaction_manager,
114 std::shared_ptr<transactional_map>
get_map(
const std::string& name)
127 std::shared_ptr<transactional_queue>
get_queue(
const std::string& name)
130 iqueue::SERVICE_NAME, name);
141 const std::string& name)
144 multi_map::SERVICE_NAME, name);
154 std::shared_ptr<transactional_list>
get_list(
const std::string& name)
167 std::shared_ptr<transactional_set>
get_set(
const std::string& name)
182 const std::string& name)
184 if (transaction_.get_state() != txn::TxnState::ACTIVE) {
185 std::string message =
"No transaction is found while accessing ";
186 message +=
"transactional object -> [" + name +
"]!";
187 BOOST_THROW_EXCEPTION(exception::illegal_state(
188 "TransactionContext::getMap(const std::string& name)", message));
190 auto key = std::make_pair(service_name, name);
191 std::shared_ptr<T> obj =
192 std::static_pointer_cast<T>(txn_object_map_.get(key));
194 obj = std::shared_ptr<T>(
new T(name, transaction_));
195 txn_object_map_.put(key, obj);
203 std::shared_ptr<connection::Connection> txn_connection_;
204 txn::TransactionProxy transaction_;
205 util::SynchronizedMap<std::pair<std::string, std::string>,
206 proxy::TransactionalObject>
212#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
boost::future< void > begin_transaction()
Begins a transaction.
std::shared_ptr< transactional_multi_map > get_multi_map(const std::string &name)
Returns the transactional multimap instance with the specified name.
boost::future< void > commit_transaction()
Commits a transaction.
std::shared_ptr< transactional_set > get_set(const std::string &name)
Returns the transactional set instance with the specified name.
std::shared_ptr< T > get_transactional_object(const std::string &service_name, const std::string &name)
get any transactional object with template T.
boost::future< void > rollback_transaction()
Begins a transaction.
std::shared_ptr< transactional_map > get_map(const std::string &name)
Returns the transactional distributed map instance with the specified name.
std::shared_ptr< transactional_list > get_list(const std::string &name)
Returns the transactional list instance with the specified name.
boost::uuids::uuid get_txn_id() const
std::shared_ptr< transactional_queue > get_queue(const std::string &name)
Returns the transactional queue instance with the specified name.
transaction_context(spi::impl::ClientTransactionManagerServiceImpl &transaction_manager, const transaction_options &)
Constructor to be used internally.
Contains the configuration for a Hazelcast transaction.