MongoDB C++ Driver current
Loading...
Searching...
No Matches
transaction.hpp
1// Copyright 2018-present MongoDB Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
17#include <chrono>
18#include <memory>
19
20#include <bsoncxx/stdx/optional.hpp>
21#include <mongocxx/stdx.hpp>
22
23#include <mongocxx/config/prelude.hpp>
24
25namespace mongocxx {
26inline namespace v_noabi {
27class client_session;
28class read_concern;
29class write_concern;
30class read_preference;
31
32namespace options {
33
37class MONGOCXX_API transaction {
38 public:
40
45
50
55
59 transaction& operator=(transaction&&) noexcept;
60
64 ~transaction() noexcept;
65
77
84 stdx::optional<class read_concern> read_concern() const;
85
97
106 stdx::optional<class write_concern> write_concern() const;
107
119
126 stdx::optional<class read_preference> read_preference() const;
127
137 transaction& max_commit_time_ms(std::chrono::milliseconds ms);
138
146 stdx::optional<std::chrono::milliseconds> max_commit_time_ms() const;
147
148 private:
149 friend class ::mongocxx::client_session;
150
151 class MONGOCXX_PRIVATE impl;
152
153 MONGOCXX_PRIVATE impl& _get_impl();
154 MONGOCXX_PRIVATE const impl& _get_impl() const;
155 std::unique_ptr<impl> _impl;
156};
157
158} // namespace options
159} // namespace v_noabi
160} // namespace mongocxx
161
162#include <mongocxx/config/postlude.hpp>
Class representing the optional arguments to mongocxx::client::start_session.
Definition client_session.hpp:32
Class representing the optional arguments for a transaction.
Definition transaction.hpp:37
transaction(transaction &&) noexcept
Move constructs transaction options.
transaction(const transaction &)
Copy constructs transaction options.
transaction & operator=(const transaction &)
Copy assigns transaction options.
A class to represent the read concern.
Definition read_concern.hpp:57
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition read_preference.hpp:67
Class representing the server-side requirement for reporting the success of a write operation.
Definition write_concern.hpp:59
The top-level namespace for mongocxx library entities.
Definition bulk_write.hpp:24