![]() |
Hazelcast C++ Client
Hazelcast C++ Client Library
|
Contains the configuration for a Hazelcast transaction. More...
#include <transaction_options.h>
Public Types | |
enum class | transaction_type { TWO_PHASE = 1 , LOCAL = 2 } |
Transaction type. | |
Public Member Functions | |
transaction_options () | |
Creates a new default configured TransactionsOptions. More... | |
transaction_type | get_transaction_type () const |
transaction_options & | set_transaction_type (transaction_type transaction_type) |
Sets the TransactionType. More... | |
std::chrono::milliseconds | get_timeout () const |
transaction_options & | set_timeout (std::chrono::milliseconds duration) |
The timeout determines the maximum lifespan of a transaction. More... | |
int | get_durability () const |
transaction_options & | set_durability (int num_machines) |
Sets the transaction durability. More... | |
Contains the configuration for a Hazelcast transaction.
Definition at line 31 of file transaction_options.h.
hazelcast::client::transaction_options::transaction_options | ( | ) |
Creates a new default configured TransactionsOptions.
It will be configured with a timeout of 2 minutes, durability of 1 and a TransactionType.TWO_PHASE.
Definition at line 586 of file transactions.cpp.
int hazelcast::client::transaction_options::get_durability | ( | ) | const |
Definition at line 611 of file transactions.cpp.
std::chrono::milliseconds hazelcast::client::transaction_options::get_timeout | ( | ) | const |
Definition at line 598 of file transactions.cpp.
transaction_options::transaction_type hazelcast::client::transaction_options::get_transaction_type | ( | ) | const |
Definition at line 589 of file transactions.cpp.
transaction_options & hazelcast::client::transaction_options::set_durability | ( | int | num_machines | ) |
Sets the transaction durability.
The durability is the number of machines that can take over if a member fails during a transaction commit or rollback. This value only has meaning when TransactionType::TWO_PHASE is selected.
durability | the durability |
illegal_argument | if durability smaller than 0. |
Definition at line 615 of file transactions.cpp.
transaction_options & hazelcast::client::transaction_options::set_timeout | ( | std::chrono::milliseconds | duration | ) |
The timeout determines the maximum lifespan of a transaction.
So if a transaction is configured with a timeout of 2 minutes, then it will automatically rollback if it hasn't committed yet.
timeoutInSeconds | the timeout value. |
illegal_argument | if timeout smaller or equal than 0, or timeUnit is null. |
Definition at line 602 of file transactions.cpp.
transaction_options & hazelcast::client::transaction_options::set_transaction_type | ( | transaction_type | transaction_type | ) |
Sets the TransactionType.
A local transaction is less safe than a two phase transaction; when a member fails during the commit of a local transaction, it could be that some of the changes are committed, while others are not and this can leave your system in an inconsistent state.
transactionType | the new TransactionType. |
Definition at line 593 of file transactions.cpp.