Couchbase Transactions C++ Client  1.0.0
Transactions client for couchbase
Public Member Functions | Protected Attributes | List of all members
couchbase::transactions::transaction_config Class Reference

Configuration parameters for transactions. More...

#include <transaction_config.hxx>

Public Member Functions

 transaction_config (const transaction_config &c)
 
transaction_configoperator= (const transaction_config &c)
 
CB_NODISCARD couchbase::transactions::durability_level durability_level () const
 Get the default durability level for all transaction operations. More...
 
void durability_level (enum couchbase::transactions::durability_level level)
 Set the default durability level for all transaction operations. More...
 
CB_NODISCARD std::chrono::milliseconds cleanup_window () const
 Get cleanup window. More...
 
template<typename T >
void cleanup_window (T duration)
 Set cleanup window. More...
 
template<typename T >
void kv_timeout (T duration)
 Set kv_timeout. More...
 
CB_NODISCARD boost::optional< std::chrono::milliseconds > kv_timeout () const
 Get kv_timeout. More...
 
CB_NODISCARD std::chrono::nanoseconds expiration_time () const
 Get expiration time for transactions. More...
 
template<typename T >
void expiration_time (T duration)
 Set the expiration time for transactions. More...
 
void cleanup_lost_attempts (bool value)
 Enable/disable the lost attempts cleanup loop. More...
 
CB_NODISCARD bool cleanup_lost_attempts () const
 Get lost attempts cleanup loop status. More...
 
void cleanup_client_attempts (bool value)
 Set state for the client attempts cleanup loop. More...
 
CB_NODISCARD bool cleanup_client_attempts () const
 Get state of client attempts cleanup loop. More...
 
void test_factories (attempt_context_testing_hooks &hooks, cleanup_testing_hooks &cleanup_hooks)
 
attempt_context_testing_hooks & attempt_context_hooks () const
 
cleanup_testing_hooks & cleanup_hooks () const
 

Protected Attributes

couchbase::transactions::durability_level level_
 
std::chrono::milliseconds cleanup_window_
 
std::chrono::nanoseconds expiration_time_
 
boost::optional< std::chrono::milliseconds > kv_timeout_
 
bool cleanup_lost_attempts_
 
bool cleanup_client_attempts_
 
std::unique_ptr< attempt_context_testing_hooks > attempt_context_hooks_
 
std::unique_ptr< cleanup_testing_hooks > cleanup_hooks_
 

Detailed Description

Configuration parameters for transactions.

Examples:
examples/game_server.cxx.

Member Function Documentation

◆ attempt_context_hooks()

attempt_context_testing_hooks& couchbase::transactions::transaction_config::attempt_context_hooks ( ) const
inline
Stability
Internal:

◆ cleanup_client_attempts() [1/2]

void couchbase::transactions::transaction_config::cleanup_client_attempts ( bool  value)
inline

Set state for the client attempts cleanup loop.

See also
cleanup_client_attempts()
Parameters
valueIf true, run the cleanup client attempts loop.

◆ cleanup_client_attempts() [2/2]

CB_NODISCARD bool couchbase::transactions::transaction_config::cleanup_client_attempts ( ) const
inline

Get state of client attempts cleanup loop.

A transactions object will create a background thread to do any cleanup necessary for the transactions it has attempted. This can be disabled if set to false.

Returns
true if the thread is enabled, false if not.

◆ cleanup_hooks()

cleanup_testing_hooks& couchbase::transactions::transaction_config::cleanup_hooks ( ) const
inline
Stability
Internal:

◆ cleanup_lost_attempts() [1/2]

void couchbase::transactions::transaction_config::cleanup_lost_attempts ( bool  value)
inline

Enable/disable the lost attempts cleanup loop.

See also
cleanup_window() for description of the cleanup lost attempts loop.
Parameters
valueIf false, do not start the lost attempts cleanup threads.

◆ cleanup_lost_attempts() [2/2]

CB_NODISCARD bool couchbase::transactions::transaction_config::cleanup_lost_attempts ( ) const
inline

Get lost attempts cleanup loop status.

See also
cleanup_window() for description of the lost attempts cleanup loop.
Returns
If false, no lost attempts cleanup threads will be launched.

◆ cleanup_window() [1/2]

CB_NODISCARD std::chrono::milliseconds couchbase::transactions::transaction_config::cleanup_window ( ) const
inline

Get cleanup window.

Each transactions instance has background threads which looks for evidence of transactions that somehow were not cleaned up during ordinary processing. There is one of these per bucket. The thread looks through the active transaction records on that bucket once during each window. There are potentially 1024 of these records, so over one cleanup window period, the thread will look for all 1024 of these, and examine any it finds. Note you can disable this by setting cleanup_lost_attempts() false.

Returns
The cleanup window.

◆ cleanup_window() [2/2]

template<typename T >
void couchbase::transactions::transaction_config::cleanup_window ( duration)
inline

Set cleanup window.

See also
cleanup_window() for more info.
Parameters
durationAn std::chrono::duration representing the cleanup window duration.

◆ durability_level() [1/2]

CB_NODISCARD couchbase::transactions::durability_level couchbase::transactions::transaction_config::durability_level ( ) const
inline

Get the default durability level for all transaction operations.

Returns
The default durability level used for write operations.
Examples:
examples/game_server.cxx.

◆ durability_level() [2/2]

void couchbase::transactions::transaction_config::durability_level ( enum couchbase::transactions::durability_level  level)
inline

Set the default durability level for all transaction operations.

Parameters
levelThe default durability level desired for write operations.

◆ expiration_time() [1/2]

CB_NODISCARD std::chrono::nanoseconds couchbase::transactions::transaction_config::expiration_time ( ) const
inline

Get expiration time for transactions.

Transactions can conflict with eachother (or other operations on those documents), and may retry. This is the maximum time a transaction can take, including any retries. The transaction will throw an transaction_expired and rollback when this occurs.

Returns
expiration time for transactions.

◆ expiration_time() [2/2]

template<typename T >
void couchbase::transactions::transaction_config::expiration_time ( duration)
inline

Set the expiration time for transactions.

Parameters
durationdesired expiration for transactions. see ().

◆ kv_timeout() [1/2]

template<typename T >
void couchbase::transactions::transaction_config::kv_timeout ( duration)
inline

Set kv_timeout.

See also
kv_timeout()
Parameters
durationAn std::chrono::duration representing the desired default kv operation timeout.

◆ kv_timeout() [2/2]

CB_NODISCARD boost::optional<std::chrono::milliseconds> couchbase::transactions::transaction_config::kv_timeout ( ) const
inline

Get kv_timeout.

This is the default kv operation timeout used throughout the transactions. Note all the operations have an options class which allows you to override this value for a particular operation, if desired.

Returns
The default kv operation timeout.

◆ test_factories()

void couchbase::transactions::transaction_config::test_factories ( attempt_context_testing_hooks &  hooks,
cleanup_testing_hooks &  cleanup_hooks 
)
Stability
Internal:

The documentation for this class was generated from the following file: