MongoDB C++ Driver current
Loading...
Searching...
No Matches
read_concern.hpp
1// Copyright 2015 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/document/value.hpp>
20#include <bsoncxx/stdx/optional.hpp>
21#include <bsoncxx/stdx/string_view.hpp>
22#include <mongocxx/options/transaction.hpp>
23#include <mongocxx/stdx.hpp>
24
25#include <mongocxx/config/prelude.hpp>
26
27namespace mongocxx {
28inline namespace v_noabi {
29class client;
30class collection;
31class database;
32class uri;
33
34namespace options {
35class transaction;
36}
37
57class MONGOCXX_API read_concern {
58 public:
64 enum class level {
65 k_local,
66 k_majority,
67 k_linearizable,
68 k_server_default,
69 k_unknown,
70 k_available,
71 k_snapshot
72 };
73
82
87
92
97
101 read_concern& operator=(read_concern&&) noexcept;
102
107
118 void acknowledge_level(level rc_level);
119
128 level acknowledge_level() const;
129
139 void acknowledge_string(stdx::string_view rc_string);
140
149 stdx::string_view acknowledge_string() const;
150
157 bsoncxx::document::value to_document() const;
158
159 private:
160 friend class client;
161 friend class collection;
162 friend class database;
163 friend class uri;
164
165 friend class options::transaction;
166
174 friend MONGOCXX_API bool MONGOCXX_CALL operator==(const read_concern&, const read_concern&);
175 friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const read_concern&, const read_concern&);
179
180 class MONGOCXX_PRIVATE impl;
181
182 MONGOCXX_PRIVATE read_concern(std::unique_ptr<impl>&& implementation);
183
184 std::unique_ptr<impl> _impl;
185};
186
187} // namespace v_noabi
188} // namespace mongocxx
189
190#include <mongocxx/config/postlude.hpp>
Class representing a client connection to MongoDB.
Definition client.hpp:54
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:85
Class representing a MongoDB database.
Definition database.hpp:44
A class to represent the read concern.
Definition read_concern.hpp:57
read_concern(read_concern &&) noexcept
Move constructs a read_concern.
level
A class to represent the read concern level.
Definition read_concern.hpp:64
read_concern()
Constructs a new read_concern with default acknowledge_level of k_server_default.
read_concern & operator=(const read_concern &)
Copy assigns a read_concern.
read_concern(const read_concern &)
Copy constructs a read_concern.
Class representing a MongoDB connection string URI.
Definition uri.hpp:42
The top-level namespace for bsoncxx library entities.
Definition element.hpp:24
The top-level namespace for mongocxx library entities.
Definition bulk_write.hpp:24