MongoDB C++ Driver  mongocxx-3.4.2
All Classes Namespaces Functions Typedefs Enumerations Enumerator Friends Pages
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 <memory>
18 
19 #include <bsoncxx/stdx/optional.hpp>
20 #include <mongocxx/stdx.hpp>
21 
22 #include <mongocxx/config/prelude.hpp>
23 
24 namespace mongocxx {
25 MONGOCXX_INLINE_NAMESPACE_BEGIN
26 
27 class client_session;
28 class read_concern;
29 class write_concern;
30 class read_preference;
31 
32 namespace options {
33 
37 class MONGOCXX_API transaction {
38  public:
39  transaction();
40 
44  transaction(const transaction&);
45 
49  transaction& operator=(const transaction&);
50 
54  transaction(transaction&&) noexcept;
55 
59  transaction& operator=(transaction&&) noexcept;
60 
64  ~transaction() noexcept;
65 
76  transaction& read_concern(const class read_concern& rc);
77 
84  stdx::optional<class read_concern> read_concern() const;
85 
96  transaction& write_concern(const class write_concern& wc);
97 
106  stdx::optional<class write_concern> write_concern() const;
107 
118  transaction& read_preference(const class read_preference& rp);
119 
126  stdx::optional<class read_preference> read_preference() const;
127 
128  private:
129  friend class ::mongocxx::client_session;
130 
131  class MONGOCXX_PRIVATE impl;
132 
133  MONGOCXX_PRIVATE impl& _get_impl();
134  MONGOCXX_PRIVATE const impl& _get_impl() const;
135  std::unique_ptr<impl> _impl;
136 };
137 
138 } // namespace options
139 MONGOCXX_INLINE_NAMESPACE_END
140 } // namespace mongocxx
141 
142 #include <mongocxx/config/postlude.hpp>
Class representing the optional arguments for a transaction.
Definition: transaction.hpp:37
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
Class representing a preference for how the driver routes read operations to members of a replica set...
Definition: read_preference.hpp:62
A class to represent the read concern.
Definition: read_concern.hpp:53
Class representing the server-side requirement for reporting the success of a write operation...
Definition: write_concern.hpp:56