MongoDB C++ Driver current
Loading...
Searching...
No Matches
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 <bsoncxx/stdx/optional.hpp>
18#include <mongocxx/options/transaction.hpp>
19#include <mongocxx/stdx.hpp>
20
21#include <mongocxx/config/prelude.hpp>
22
23namespace mongocxx {
24inline namespace v_noabi {
25class client_session;
26
27namespace options {
28
32class MONGOCXX_API client_session {
33 public:
52 client_session& causal_consistency(bool causal_consistency) noexcept;
53
58 bool causal_consistency() const noexcept;
59
74 client_session& snapshot(bool enable_snapshot_reads) noexcept;
75
79 bool snapshot() const noexcept;
80
91 client_session& default_transaction_opts(transaction default_transaction_opts);
92
98 const stdx::optional<transaction>& default_transaction_opts() const;
99
100 private:
101 // Allow the implementation of client_session to see these:
102 friend class mongocxx::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::client::start_session.
Definition client_session.hpp:32
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.
Class representing the optional arguments for a transaction.
Definition transaction.hpp:37
The top-level namespace for mongocxx library entities.
Definition bulk_write.hpp:24