Couchbase C++ SDK 1.4.0 (rev. 59aa900)
Loading...
Searching...
No Matches
transactions.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2020-Present Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
24
25#include <functional>
26
27#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
28namespace couchbase
29{
30namespace transactions
31{
32class transactions_impl;
33} // namespace transactions
34
35namespace core::transactions
36{
37class transactions;
38} // namespace core::transactions
39} // namespace couchbase
40#endif
41
43{
44using txn_logic = std::function<error(std::shared_ptr<attempt_context>)>;
45using async_txn_logic = std::function<error(std::shared_ptr<async_attempt_context>)>;
47
52{
53public:
70 auto run(txn_logic&& logic, const transaction_options& cfg = {})
71 -> std::pair<error, transaction_result>;
72
92 void run(async_txn_logic&& logic,
93 async_txn_complete_logic&& complete_callback,
94 const transaction_options& cfg = {});
95
99 explicit transactions(std::shared_ptr<core::transactions::transactions> core_txns);
100
101private:
102 std::shared_ptr<transactions_impl> impl_;
103};
104} // namespace couchbase::transactions
Definition error.hxx:31
The transaction_options can be passed in to override some elements of the global transactions_config.
Definition transaction_options.hxx:37
auto run(txn_logic &&logic, const transaction_options &cfg={}) -> std::pair< error, transaction_result >
Run a blocking transaction.
void run(async_txn_logic &&logic, async_txn_complete_logic &&complete_callback, const transaction_options &cfg={})
Run an asynchronous transaction.
transactions(std::shared_ptr< core::transactions::transactions > core_txns)
Definition transaction_get_multi_options.hxx:23
Definition transactions.hxx:43
std::function< error(std::shared_ptr< async_attempt_context >)> async_txn_logic
Definition transactions.hxx:45
std::function< error(std::shared_ptr< attempt_context >)> txn_logic
Definition transactions.hxx:44
std::function< void(error, transaction_result)> async_txn_complete_logic
Definition transactions.hxx:46
Represents a single item from the result of scan().
Definition allow_querying_search_index_options.hxx:28
@ error
Indicates that the ping operation failed.
Definition endpoint_ping_report.hxx:52
Results of a transaction.
Definition transaction_result.hxx:29