Loading...
Searching...
No Matches
server_description.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/server_description-fwd.hpp> // IWYU pragma: export
//
#include <mongocxx/v1/events/server_description.hpp> // IWYU pragma: export
#include <cstdint>
#include <utility>
#include <bsoncxx/document/view.hpp>
#include <bsoncxx/stdx/string_view.hpp>
#include <mongocxx/config/prelude.hpp>
namespace mongocxx {
namespace v_noabi {
namespace events {
class server_description {
public:
explicit server_description(void const* sd) : _sd(sd) {}
/* explicit(false) */ MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE() server_description(
v1::events::server_description const& other);
explicit MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE() operator v1::events::server_description() const;
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(std::uint32_t) id() const;
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(std::int64_t) round_trip_time() const;
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::stdx::string_view) type() const;
MONGOCXX_DEPRECATED bsoncxx::v_noabi::document::view is_master() const {
return this->hello();
}
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::document::view) hello() const;
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(bsoncxx::v_noabi::stdx::string_view) host() const;
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(std::uint16_t) port() const;
private:
void const* _sd;
};
} // namespace events
} // namespace v_noabi
} // namespace mongocxx
namespace mongocxx {
namespace v_noabi {
inline v_noabi::events::server_description from_v1(v1::events::server_description v) {
return {std::move(v)};
}
inline v1::events::server_description to_v1(v_noabi::events::server_description const& v) {
return v1::events::server_description{v};
}
} // namespace v_noabi
} // namespace mongocxx
#include <mongocxx/config/postlude.hpp>
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::v1::events::server_description
ServerDescription from the Server Discovery and Monitoring specification.
Definition server_description.hpp:42
mongocxx::v_noabi::events::server_description
The description of a connected MongoDB server.
Definition server_description.hpp:41
mongocxx::v_noabi::events::server_description::port
std::uint16_t port() const
Returns the server port.
mongocxx::v_noabi::events::server_description::is_master
bsoncxx::v_noabi::document::view is_master() const
Definition server_description.hpp:86
mongocxx::v_noabi::events::server_description::round_trip_time
std::int64_t round_trip_time() const
The duration of the last hello call, indicating network latency.
mongocxx::v_noabi::events::server_description::hello
bsoncxx::v_noabi::document::view hello() const
The server's last response to the "hello" command, or an empty document if the driver has not yet rea...
mongocxx::v_noabi::events::server_description::host
bsoncxx::v_noabi::stdx::string_view host() const
Returns the server host name.
mongocxx::v_noabi::events::server_description::server_description
operator v1::events::server_description() const
Convert to the mongocxx::v1 equivalent.
mongocxx::v_noabi::events::server_description::type
bsoncxx::v_noabi::stdx::string_view type() const
The server type: "Unknown", "Standalone", "Mongos", "PossiblePrimary", "RSPrimary",...
MONGOCXX_DEPRECATED
#define MONGOCXX_DEPRECATED
Declares the associated entity as deprecated.
Definition export.hpp:25
MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE
#define MONGOCXX_ABI_EXPORT_CDECL_UNSTABLE(...)
Equivalent to MONGOCXX_ABI_EXPORT_UNSTABLE with MONGOCXX_ABI_CDECL.
Definition config.hpp:28
postlude.hpp
The mongocxx v_noabi macro guard postlude header.
prelude.hpp
The mongocxx v_noabi macro guard prelude header.
bsoncxx
The top-level namespace within which all bsoncxx library entities are declared.
mongocxx::v1
Declares entities whose ABI stability is guaranteed for documented symbols.
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.
server_description.hpp
Provides mongocxx::v1::events::server_description.
view.hpp
Provides bsoncxx::v_noabi::document::view.
string_view.hpp
Provides std::string_view-related polyfills for library API usage.
server_description-fwd.hpp
Declares mongocxx::v_noabi::events::server_description.