MongoDB C++ Driver  mongocxx-3.10.2
client_session.hpp
1 // Copyright 2017-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 <mongocxx/client_session-fwd.hpp>
18 #include <mongocxx/options/client_session-fwd.hpp>
19 
20 #include <bsoncxx/stdx/optional.hpp>
21 #include <mongocxx/options/transaction.hpp>
22 #include <mongocxx/stdx.hpp>
23 
24 #include <mongocxx/config/prelude.hpp>
25 
26 namespace mongocxx {
27 namespace v_noabi {
28 namespace options {
29 
34  public:
54 
59  bool causal_consistency() const noexcept;
60 
75  client_session& snapshot(bool enable_snapshot_reads) noexcept;
76 
80  bool snapshot() const noexcept;
81 
93 
99  const stdx::optional<transaction>& default_transaction_opts() const;
100 
101  private:
102  friend ::mongocxx::v_noabi::client_session;
103 
104  stdx::optional<bool> _causal_consistency;
105  stdx::optional<bool> _enable_snapshot_reads;
106 
107  stdx::optional<transaction> _default_transaction_opts;
108 };
109 
110 } // namespace options
111 } // namespace v_noabi
112 } // namespace mongocxx
113 
114 #include <mongocxx/config/postlude.hpp>
Class representing the optional arguments to mongocxx::v_noabi::client::start_session.
Definition: client_session.hpp:33
const stdx::optional< transaction > & default_transaction_opts() const
Gets the current default transaction options.
client_session & causal_consistency(bool causal_consistency) noexcept
Sets the causal_consistency option.
bool causal_consistency() const noexcept
Gets the value of the causal_consistency option.
bool snapshot() const noexcept
Gets the value of the snapshot_reads option.
Class representing the optional arguments for a transaction.
Definition: transaction.hpp:38
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19