Provides a context to do transactional operations; so beginning/committing transactions, but also retrieving transactional data-structures like the TransactionalMap.  
 More...
#include <transaction_context.h>
Provides a context to do transactional operations; so beginning/committing transactions, but also retrieving transactional data-structures like the TransactionalMap. 
- See also
 - hazelcast_client::newTransactionContext 
 
Definition at line 63 of file transaction_context.h.
 
◆ transaction_context()
      
        
          | hazelcast::client::transaction_context::transaction_context  | 
          ( | 
          spi::impl::ClientTransactionManagerServiceImpl &  | 
          transaction_manager,  | 
        
        
           | 
           | 
          const transaction_options &  | 
          txn_options  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Constructor to be used internally. 
Not public API. 
Definition at line 715 of file transactions.cpp.
  718   : options_(txn_options)
 
  719   , txn_connection_(transaction_manager.connect())
 
  720   , transaction_(options_, transaction_manager.get_client(), txn_connection_)
 
 
 
 
◆ begin_transaction()
      
        
          | boost::future< void > hazelcast::client::transaction_context::begin_transaction  | 
          ( | 
           | ) | 
           | 
        
      
 
Begins a transaction. 
- Exceptions
 - 
  
    | illegal_state | if a transaction already is active.  | 
  
   
Definition at line 730 of file transactions.cpp.
  732     return transaction_.begin();
 
 
 
 
◆ commit_transaction()
      
        
          | boost::future< void > hazelcast::client::transaction_context::commit_transaction  | 
          ( | 
           | ) | 
           | 
        
      
 
Commits a transaction. 
- Exceptions
 - 
  
    | transaction | if no transaction is active or the transaction could not be committed.  | 
  
   
Definition at line 736 of file transactions.cpp.
  738     return transaction_.commit();
 
 
 
 
◆ get_list()
  
  
      
        
          | std::shared_ptr<transactional_list> hazelcast::client::transaction_context::get_list  | 
          ( | 
          const std::string &  | 
          name | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Returns the transactional list instance with the specified name. 
- Parameters
 - 
  
  
 
- Returns
 - transactional list instance with the specified name 
 
Definition at line 149 of file transaction_context.h.
  151         return get_transactional_object<transactional_list>(ilist::SERVICE_NAME,
 
 
 
 
◆ get_map()
  
  
      
        
          | std::shared_ptr<transactional_map> hazelcast::client::transaction_context::get_map  | 
          ( | 
          const std::string &  | 
          name | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Returns the transactional distributed map instance with the specified name. 
- Parameters
 - 
  
    | name | name of the distributed map  | 
  
   
- Returns
 - transactional distributed map instance with the specified name 
 
Definition at line 109 of file transaction_context.h.
  111         return get_transactional_object<transactional_map>(imap::SERVICE_NAME,
 
 
 
 
◆ get_multi_map()
  
  
      
        
          | std::shared_ptr<transactional_multi_map> hazelcast::client::transaction_context::get_multi_map  | 
          ( | 
          const std::string &  | 
          name | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Returns the transactional multimap instance with the specified name. 
- Parameters
 - 
  
  
 
- Returns
 - transactional multimap instance with the specified name 
 
Definition at line 135 of file transaction_context.h.
  138         return get_transactional_object<transactional_multi_map>(
 
  139           multi_map::SERVICE_NAME, name);
 
 
 
 
◆ get_queue()
  
  
      
        
          | std::shared_ptr<transactional_queue> hazelcast::client::transaction_context::get_queue  | 
          ( | 
          const std::string &  | 
          name | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Returns the transactional queue instance with the specified name. 
- Parameters
 - 
  
  
 
- Returns
 - transactional queue instance with the specified name 
 
Definition at line 122 of file transaction_context.h.
  124         return get_transactional_object<transactional_queue>(
 
  125           iqueue::SERVICE_NAME, name);
 
 
 
 
◆ get_set()
  
  
      
        
          | std::shared_ptr<transactional_set> hazelcast::client::transaction_context::get_set  | 
          ( | 
          const std::string &  | 
          name | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Returns the transactional set instance with the specified name. 
- Parameters
 - 
  
  
 
- Returns
 - transactional set instance with the specified name 
 
Definition at line 162 of file transaction_context.h.
  164         return get_transactional_object<transactional_set>(iset::SERVICE_NAME,
 
 
 
 
◆ get_transactional_object()
template<typename T > 
  
  
      
        
          | std::shared_ptr<T> hazelcast::client::transaction_context::get_transactional_object  | 
          ( | 
          const std::string &  | 
          service_name,  | 
         
        
           | 
           | 
          const std::string &  | 
          name  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
get any transactional object with template T. 
Mostly to be used by spi implementers of Hazelcast.
- Returns
 - transactionalObject. 
 
Definition at line 176 of file transaction_context.h.
  179         if (transaction_.get_state() != txn::TxnState::ACTIVE) {
 
  180             std::string message = 
"No transaction is found while accessing ";
 
  181             message += 
"transactional object -> [" + name + 
"]!";
 
  182             BOOST_THROW_EXCEPTION(exception::illegal_state(
 
  183               "TransactionContext::getMap(const std::string& name)", message));
 
  185         auto key = std::make_pair(service_name, name);
 
  186         std::shared_ptr<T> obj =
 
  187           std::static_pointer_cast<T>(txn_object_map_.get(key));
 
  189             obj = std::shared_ptr<T>(
new T(name, transaction_));
 
  190             txn_object_map_.put(key, obj);
 
 
 
 
◆ get_txn_id()
      
        
          | boost::uuids::uuid hazelcast::client::transaction_context::get_txn_id  | 
          ( | 
           | ) | 
           const | 
        
      
 
- Returns
 - txn id. 
 
Definition at line 724 of file transactions.cpp.
  726     return transaction_.get_txn_id();
 
 
 
 
◆ rollback_transaction()
      
        
          | boost::future< void > hazelcast::client::transaction_context::rollback_transaction  | 
          ( | 
           | ) | 
           | 
        
      
 
Begins a transaction. 
- Exceptions
 - 
  
    | illegal_state | if a transaction already is active.  | 
  
   
Definition at line 742 of file transactions.cpp.
  744     return transaction_.rollback();
 
 
 
 
The documentation for this class was generated from the following files: