MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
command_failed_event.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 <mongocxx/events/command_failed_event-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <mongocxx/v1/events/command_failed.hpp> // IWYU pragma: export
22
23#include <cstdint>
24#include <memory> // IWYU pragma: keep: backward compatibility, to be removed.
25
27#include <bsoncxx/oid.hpp>
30
32
33namespace mongocxx {
34namespace v_noabi {
35namespace events {
36
44 private:
46
47 public:
51 explicit MONGOCXX_ABI_NO_EXPORT command_failed_event(void const* event);
52
56 /* explicit(false) */ command_failed_event(v1::events::command_failed const& event) : _event{event} {}
57
61 explicit operator v1::events::command_failed() const {
62 return _event;
63 }
64
71 return _event.failure();
72 }
73
80 return _event.command_name();
81 }
82
88 std::int64_t duration() const {
89 return _event.duration();
90 }
91
97 std::int64_t request_id() const {
98 return _event.request_id();
99 }
100
106 std::int64_t operation_id() const {
107 return _event.operation_id();
108 }
109
116 return _event.service_id();
117 }
118
125 return _event.host();
126 }
127
133 std::uint16_t port() const {
134 return _event.port();
135 }
136};
137
138} // namespace events
139} // namespace v_noabi
140} // namespace mongocxx
141
142namespace mongocxx {
143namespace v_noabi {
144
151
158
159} // namespace v_noabi
160} // namespace mongocxx
161
163
A polyfill for std::optional<T>.
Definition optional.hpp:799
A polyfill for std::string_view.
Definition string_view.hpp:412
A read-only, non-owning view of a BSON document.
Definition view.hpp:40
CommandFailedEvent from the Command Logging and Monitoring specification.
Definition command_failed.hpp:45
The failed execution of a MongoDB command.
Definition command_failed_event.hpp:43
bsoncxx::v_noabi::stdx::string_view command_name() const
Returns the name of the command.
Definition command_failed_event.hpp:79
std::int64_t operation_id() const
Returns the operation id.
Definition command_failed_event.hpp:106
command_failed_event(v1::events::command_failed const &event)
Construct with the mongocxx::v1 equivalent.
Definition command_failed_event.hpp:56
std::int64_t duration() const
Returns the duration of the failed operation.
Definition command_failed_event.hpp:88
std::uint16_t port() const
Returns the port.
Definition command_failed_event.hpp:133
bsoncxx::v_noabi::document::view failure() const
Returns the server’s reply to the failed operation.
Definition command_failed_event.hpp:70
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::oid > service_id() const
Optionally returns the service id.
Definition command_failed_event.hpp:115
bsoncxx::v_noabi::stdx::string_view host() const
Returns the host name.
Definition command_failed_event.hpp:124
std::int64_t request_id() const
Returns the request id.
Definition command_failed_event.hpp:97
Provides mongocxx::v1::events::command_failed.
Declares mongocxx::v_noabi::events::command_failed_event.
#define MONGOCXX_ABI_NO_EXPORT
Excludes the associated entity from being part of the ABI.
Definition export.hpp:20
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
Declares entities describing APM events.
Declares entities whose ABI stability is NOT guaranteed.
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
The top-level namespace within which all mongocxx library entities are declared.
Provides bsoncxx::v_noabi::document::view.
Provides bsoncxx::v_noabi::oid.
Provides std::optional-related polyfills for library API usage.
Provides std::string_view-related polyfills for library API usage.