MongoDB C++ Driver mongocxx-4.0.0
Loading...
Searching...
No Matches
write_concern.hpp
Go to the documentation of this file.
1// Copyright 2009-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 <chrono>
18#include <cstdint>
19#include <memory>
20#include <stdexcept>
21#include <string>
22
28#include <mongocxx/uri-fwd.hpp>
30
34
36
38
39namespace mongocxx {
40namespace v_noabi {
41
61 public:
69 enum class level {
70 k_default,
72 k_tag,
75 };
76
81
86
91
96
101
106
116
132 MONGOCXX_ABI_EXPORT_CDECL(void) nodes(std::int32_t confirm_from);
133
159
170 MONGOCXX_ABI_EXPORT_CDECL(void) majority(std::chrono::milliseconds timeout);
171
181 MONGOCXX_ABI_EXPORT_CDECL(void) tag(bsoncxx::v_noabi::stdx::string_view tag);
182
193 MONGOCXX_ABI_EXPORT_CDECL(void) timeout(std::chrono::milliseconds timeout);
194
201
213 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<std::int32_t>) nodes() const;
214
224
230 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional<std::string>) tag() const;
231
238
244 MONGOCXX_ABI_EXPORT_CDECL(std::chrono::milliseconds) timeout() const;
245
252
259 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) to_document() const;
260
267 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const write_concern&, const write_concern&);
268 friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const write_concern&, const write_concern&);
271
272 private:
273 friend ::mongocxx::v_noabi::bulk_write;
274 friend ::mongocxx::v_noabi::client;
275 friend ::mongocxx::v_noabi::collection;
276 friend ::mongocxx::v_noabi::database;
277 friend ::mongocxx::v_noabi::options::transaction;
278 friend ::mongocxx::v_noabi::uri;
279
280 class impl;
281
282 write_concern(std::unique_ptr<impl>&& implementation);
283
284 std::unique_ptr<impl> _impl;
285};
286
287} // namespace v_noabi
288} // namespace mongocxx
289
290#include <mongocxx/config/postlude.hpp>
291
Declares mongocxx::v_noabi::bulk_write.
Class representing a batch of write operations that can be sent to the server as a group.
Definition bulk_write.hpp:45
Class representing a client connection to MongoDB.
Definition client.hpp:61
Class representing server side document groupings within a MongoDB database.
Definition collection.hpp:87
Class representing a MongoDB database.
Definition database.hpp:46
Class representing a MongoDB connection string URI.
Definition uri.hpp:43
Class representing the server-side requirement for reporting the success of a write operation....
Definition write_concern.hpp:60
level acknowledge_level() const
Gets the current acknowledgment level.
bool is_acknowledged() const
Gets whether this write_concern requires an acknowledged write.
std::chrono::milliseconds timeout() const
Gets the current timeout for this write_concern.
bool journal() const
Gets the current status of the journal parameter.
level
A class to represent the write concern level for write operations.
Definition write_concern.hpp:69
@ k_unacknowledged
Represent write concern with w: 0.
@ k_tag
Represent write concern with w: <custom write concern name>.
@ k_acknowledged
Represent write concern with w: 1.
@ k_majority
Represent write concern with w: "majority".
@ k_default
Represent the implicit default write concern.
bsoncxx::v_noabi::document::value to_document() const
Gets the document form of this write_concern.
bool majority() const
Gets whether the majority of nodes is currently required by this write_concern.
bsoncxx::v_noabi::stdx::optional< std::string > tag() const
Gets the current getLastErrorMode that is required by this write_concern.
bsoncxx::v_noabi::stdx::optional< std::int32_t > nodes() const
Gets the current number of nodes that this write_concern requires operations to reach....
Declares mongocxx::v_noabi::client.
Declares mongocxx::v_noabi::collection.
Declares mongocxx::v_noabi::database.
Provides bsoncxx::v_noabi::document::value.
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition fwd.hpp:204
The mongocxx macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
The top-level namespace within which all mongocxx library entities are declared.
The top-level namespace reserved for the C++ standard library.
Provides std::optional-related polyfills for library API usage.
Provides std::string_view-related polyfills for library API usage.
Declares mongocxx::v_noabi::options::transaction.
Provides mongocxx::v_noabi::options::transaction.
Declares mongocxx::v_noabi::uri.
Declares mongocxx::v_noabi::write_concern.