MongoDB C++ Driver mongocxx-3.1.1
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/stdx/optional.hpp>
20#include <bsoncxx/stdx/string_view.hpp>
21#include <mongocxx/stdx.hpp>
22
23#include <mongocxx/config/prelude.hpp>
24
25namespace mongocxx {
26MONGOCXX_INLINE_NAMESPACE_BEGIN
27
28class client;
29class collection;
30class database;
31class uri;
32
52class MONGOCXX_API read_concern {
53 public:
59 enum class level {
60 k_local,
61 k_majority,
62 k_linearizable,
63 k_server_default,
64 k_unknown,
65 };
66
75
80
85
90
94 read_concern& operator=(read_concern&&) noexcept;
95
100
111 void acknowledge_level(level rc_level);
112
121 level acknowledge_level() const;
122
131 void acknowledge_string(stdx::string_view rc_string);
132
141 stdx::string_view acknowledge_string() const;
142
143 private:
144 friend client;
145 friend collection;
146 friend database;
147 friend uri;
148
149 class MONGOCXX_PRIVATE impl;
150
151 MONGOCXX_PRIVATE read_concern(std::unique_ptr<impl>&& implementation);
152
153 std::unique_ptr<impl> _impl;
154};
155
156MONGOCXX_INLINE_NAMESPACE_END
157} // namespace mongocxx
158
159#include <mongocxx/config/postlude.hpp>
Class representing a client connection to MongoDB.
Definition client.hpp:52
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:74
Class representing a MongoDB database.
Definition database.hpp:44
A class to represent the read concern.
Definition read_concern.hpp:52
read_concern & operator=(const read_concern &)
Copy assigns a read_concern.
level
A class to represent the read concern level.
Definition read_concern.hpp:59
read_concern(read_concern &&) noexcept
Move constructs a read_concern.
read_concern(const read_concern &)
Copy constructs a read_concern.
read_concern()
Constructs a new read_concern with default acknowledge_level of k_server_default.
Class representing a MongoDB connection string URI.
Definition uri.hpp:40
Top level namespace for the MongoDB C++ driver.
Definition bulk_write.hpp:22