Couchbase C++ SDK 1.0.2 (rev. 51f4775)
Loading...
Searching...
No Matches
transaction_options Class Reference

The transaction_options can be passed in to override some elements of the global transactions_config. More...

#include <couchbase/transactions/transaction_options.hxx>

Public Member Functions

 transaction_options ()=default
 
auto durability_level (durability_level level) -> transaction_options &
 Set durability for this transaction.
 
auto durability_level () const -> std::optional< couchbase::durability_level >
 Get the durability if it has been set.
 
auto scan_consistency (query_scan_consistency scan_consistency) -> transaction_options &
 Set the query_scan_consistency for this transaction.
 
auto scan_consistency () const -> std::optional< query_scan_consistency >
 Get the scan_consistency if it has been set.
 
template<typename T >
auto timeout (T timeout) -> transaction_options &
 Set the timeout for this transaction.
 
auto timeout () -> std::optional< std::chrono::nanoseconds >
 Get the timeout, if set.
 
auto metadata_collection (const couchbase::collection &coll) -> transaction_options &
 Set the metadata collection to use for this transaction.
 
auto metadata_collection (const couchbase::transactions::transaction_keyspace &keyspace) -> transaction_options &
 Set metadata collection to use for this transaction.
 
auto metadata_collection () const -> std::optional< transaction_keyspace >
 Get the metadata collection, if set.
 

Detailed Description

The transaction_options can be passed in to override some elements of the global transactions_config.

Constructor & Destructor Documentation

◆ transaction_options()

transaction_options ( )
default

Member Function Documentation

◆ durability_level() [1/2]

auto durability_level ( ) const -> std::optional< couchbase::durability_level >
nodiscard

Get the durability if it has been set.

See also
couchbase::durability_level for details.
Returns
durability if set.

◆ durability_level() [2/2]

Set durability for this transaction.

See also
couchbase::durability_level for details.
Parameters
levelDurability level for this transaction.
Returns
reference to this object, convenient for chaining operations.

◆ metadata_collection() [1/3]

auto metadata_collection ( ) const -> std::optional< transaction_keyspace >
nodiscard

Get the metadata collection, if set.

Returns
the metadata collection, as a transaction_keyspace, if set.

◆ metadata_collection() [2/3]

auto metadata_collection ( const couchbase::collection & coll) -> transaction_options &

Set the metadata collection to use for this transaction.

Transactions involve a the creation and use of some metadata documents, which by default are placed in the default collection of scope which the first document in the that has a mutating operation performed on it. However, you can set this to a specific collection to isolate these documents from your documents, if desired.

Parameters
collThe desired collection to use.
Returns
reference to this object, convenient for chaining operations.

◆ metadata_collection() [3/3]

auto metadata_collection ( const couchbase::transactions::transaction_keyspace & keyspace) -> transaction_options&
inline

Set metadata collection to use for this transaction.

Parameters
keyspaceThe desired collection to use
Returns
reference to this object, convenient for chaining operations.

◆ scan_consistency() [1/2]

auto scan_consistency ( ) const -> std::optional< query_scan_consistency >
nodiscard

Get the scan_consistency if it has been set.

See also
query_options::scan_consistency for details.
Returns
The scan_consistency, if set.

◆ scan_consistency() [2/2]

auto scan_consistency ( query_scan_consistency scan_consistency) -> transaction_options &

Set the query_scan_consistency for this transaction.

See also
query_options::scan_consistency for details.
Parameters
scan_consistencyThe desired query_scan_consistency for this transaction.
Returns
reference to this object, convenient for chaining operations.

◆ timeout() [1/2]

auto timeout ( ) -> std::optional< std::chrono::nanoseconds >

Get the timeout, if set.

Returns
the timeout, if set.

◆ timeout() [2/2]

template<typename T >
auto timeout ( T timeout) -> transaction_options&
inline

Set the timeout for this transaction.

Template Parameters
Ttimeout type, e.g. std::chrono::milliseconds, or similar
Parameters
timeoutDesired timeout
Returns
reference to this object, convenient for chaining operations.

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