MongoDB C++ Driver  mongocxx-3.4.0
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/options/transaction.hpp>
22 #include <mongocxx/stdx.hpp>
23 
24 #include <mongocxx/config/prelude.hpp>
25 
26 namespace mongocxx {
27 MONGOCXX_INLINE_NAMESPACE_BEGIN
28 
29 class client;
30 class collection;
31 class database;
32 class uri;
33 
53 class MONGOCXX_API read_concern {
54  public:
60  enum class level {
61  k_local,
62  k_majority,
63  k_linearizable,
64  k_server_default,
65  k_unknown,
66  k_available,
67  k_snapshot
68  };
69 
77  read_concern();
78 
82  read_concern(const read_concern&);
83 
87  read_concern& operator=(const read_concern&);
88 
92  read_concern(read_concern&&) noexcept;
93 
97  read_concern& operator=(read_concern&&) noexcept;
98 
102  ~read_concern();
103 
114  void acknowledge_level(level rc_level);
115 
124  level acknowledge_level() const;
125 
135  void acknowledge_string(stdx::string_view rc_string);
136 
145  stdx::string_view acknowledge_string() const;
146 
147  private:
148  friend client;
149  friend collection;
150  friend database;
151  friend options::transaction;
152  friend uri;
153 
161  friend MONGOCXX_API bool MONGOCXX_CALL operator==(const read_concern&, const read_concern&);
162  friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const read_concern&, const read_concern&);
166 
167  class MONGOCXX_PRIVATE impl;
168 
169  MONGOCXX_PRIVATE read_concern(std::unique_ptr<impl>&& implementation);
170 
171  std::unique_ptr<impl> _impl;
172 };
173 
174 MONGOCXX_INLINE_NAMESPACE_END
175 } // namespace mongocxx
176 
177 #include <mongocxx/config/postlude.hpp>
Class representing a MongoDB connection string URI.
Definition: uri.hpp:40
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
level
A class to represent the read concern level.
Definition: read_concern.hpp:60
Class representing a client connection to MongoDB.
Definition: client.hpp:57
Class representing a MongoDB database.
Definition: database.hpp:44
A class to represent the read concern.
Definition: read_concern.hpp:53
Class representing server side document groupings within a MongoDB database.
Definition: collection.hpp:85