Loading...
Searching...
No Matches
command_failed_event.hpp
Go to the documentation of this file.
// Copyright 2009-present MongoDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mongocxx/events/command_failed_event-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/events/command_failed.hpp> // IWYU pragma: export
#include <cstdint>
#include <memory> // IWYU pragma: keep: backward compatibility, to be removed.
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/oid.hpp>
#include <bsoncxx/stdx/optional.hpp>
#include <bsoncxx/stdx/string_view.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
namespace events {
class command_failed_event {
private:
v1::events::command_failed _event;
public:
explicit MONGOCXX_ABI_NO_EXPORT command_failed_event(void const* event);
/* explicit(false) */ command_failed_event(v1::events::command_failed const& event) : _event{event} {}
explicit operator v1::events::command_failed() const {
return _event;
}
bsoncxx::v_noabi::document::view failure() const {
return _event.failure();
}
bsoncxx::v_noabi::stdx::string_view command_name() const {
return _event.command_name();
}
std::int64_t duration() const {
return _event.duration();
}
std::int64_t request_id() const {
return _event.request_id();
}
std::int64_t operation_id() const {
return _event.operation_id();
}
bsoncxx::v_noabi::stdx::optional<bsoncxx::v_noabi::oid> service_id() const {
return _event.service_id();
}
bsoncxx::v_noabi::stdx::string_view host() const {
return _event.host();
}
std::uint16_t port() const {
return _event.port();
}
};
} // namespace events
} // namespace v_noabi
} // namespace mongocxx
namespace mongocxx {
namespace v_noabi {
inline v_noabi::events::command_failed_event from_v1(v1::events::command_failed const& v) {
return {v};
}
inline v1::events::command_failed to_v1(v_noabi::events::command_failed_event const& v) {
return v1::events::command_failed{v};
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
bsoncxx::v1::stdx::optional
A polyfill for std::optional<T>.
Definition optional.hpp:799
bsoncxx::v1::stdx::string_view
A polyfill for std::string_view.
Definition string_view.hpp:412
bsoncxx::v_noabi::document::view
A read-only, non-owning view of a BSON document.
Definition view.hpp:40
mongocxx::events::command_failed_event::command_failed_event
command_failed_event(void const *event)
mongocxx::v1::events::command_failed
CommandFailedEvent from the Command Logging and Monitoring specification.
Definition command_failed.hpp:43
mongocxx::v_noabi::events::command_failed_event
The failed execution of a MongoDB command.
Definition command_failed_event.hpp:43
mongocxx::v_noabi::events::command_failed_event::command_name
bsoncxx::v_noabi::stdx::string_view command_name() const
Returns the name of the command.
Definition command_failed_event.hpp:79
mongocxx::v_noabi::events::command_failed_event::operation_id
std::int64_t operation_id() const
Returns the operation id.
Definition command_failed_event.hpp:106
mongocxx::v_noabi::events::command_failed_event::command_failed_event
command_failed_event(v1::events::command_failed const &event)
Construct with the mongocxx::v1 equivalent.
Definition command_failed_event.hpp:56
mongocxx::v_noabi::events::command_failed_event::duration
std::int64_t duration() const
Returns the duration of the failed operation.
Definition command_failed_event.hpp:88
mongocxx::v_noabi::events::command_failed_event::port
std::uint16_t port() const
Returns the port.
Definition command_failed_event.hpp:133
mongocxx::v_noabi::events::command_failed_event::failure
bsoncxx::v_noabi::document::view failure() const
Returns the server’s reply to the failed operation.
Definition command_failed_event.hpp:70
mongocxx::v_noabi::events::command_failed_event::service_id
bsoncxx::v_noabi::stdx::optional< bsoncxx::v_noabi::oid > service_id() const
Optionally returns the service id.
Definition command_failed_event.hpp:115
mongocxx::v_noabi::events::command_failed_event::command_failed_event
command_failed_event(void const *event)
mongocxx::v_noabi::events::command_failed_event::host
bsoncxx::v_noabi::stdx::string_view host() const
Returns the host name.
Definition command_failed_event.hpp:124
mongocxx::v_noabi::events::command_failed_event::request_id
std::int64_t request_id() const
Returns the request id.
Definition command_failed_event.hpp:97
command_failed.hpp
Provides mongocxx::v1::events::command_failed.
command_failed_event-fwd.hpp
Declares mongocxx::v_noabi::events::command_failed_event.
MONGOCXX_ABI_NO_EXPORT
#define MONGOCXX_ABI_NO_EXPORT
Excludes the associated entity from being part of the ABI.
Definition export.hpp:20
postlude.hpp
The mongocxx v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
mongocxx::v_noabi::events
Declares entities describing APM events.
mongocxx::v_noabi
Declares entities whose ABI stability is NOT guaranteed.
mongocxx::v_noabi::to_v1
v1::bulk_write to_v1(v_noabi::bulk_write v)
Convert to the mongocxx::v1 equivalent of v.
Definition bulk_write.hpp:162
mongocxx::v_noabi::from_v1
v_noabi::bulk_write from_v1(v1::bulk_write v)
Convert to the mongocxx::v_noabi equivalent of v.
Definition bulk_write.hpp:155
mongocxx
The top-level namespace within which all mongocxx library entities are declared.
view.hpp
Provides bsoncxx::v_noabi::document::view.
oid.hpp
Provides bsoncxx::v_noabi::oid.
optional.hpp
Provides std::optional-related polyfills for library API usage.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.