MongoDB C++ Driver 4.2.0
Loading...
Searching...
No Matches
server_description.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/server_description-fwd.hpp> // IWYU pragma: export
18
19//
20
21#include <mongocxx/v1/events/server_description.hpp> // IWYU pragma: export
22
23#include <cstdint>
24#include <utility>
25
28
30
31namespace mongocxx {
32namespace v_noabi {
33namespace events {
34
41class server_description {
42 public:
43 explicit server_description(void const* sd) : _sd(sd) {}
44
50 /* explicit(false) */ MONGOCXX_ABI_EXPORT_CDECL() server_description(v1::events::server_description const& other);
51
55 explicit MONGOCXX_ABI_EXPORT_CDECL() operator v1::events::server_description() const;
56
63 MONGOCXX_ABI_EXPORT_CDECL(std::uint32_t) id() const;
64
71
78 MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) type() const;
79
85 MONGOCXX_DEPRECATED bsoncxx::v_noabi::document::view is_master() const {
86 return this->hello();
87 }
88
96
103
109 MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const;
110
111 private:
112 void const* _sd;
113};
114
115} // namespace events
116} // namespace v_noabi
117} // namespace mongocxx
118
119namespace mongocxx {
120namespace v_noabi {
121
128
135
136} // namespace v_noabi
137} // namespace mongocxx
138
140
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
ServerDescription from the Server Discovery and Monitoring specification.
Definition server_description.hpp:44
The description of a connected MongoDB server.
Definition server_description.hpp:41
std::uint16_t port() const
Returns the server port.
bsoncxx::v_noabi::document::view is_master() const
Definition server_description.hpp:85
std::int64_t round_trip_time() const
The duration of the last hello call, indicating network latency.
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...
bsoncxx::v_noabi::stdx::string_view host() const
Returns the server host name.
operator v1::events::server_description() const
Convert to the mongocxx::v1 equivalent.
bsoncxx::v_noabi::stdx::string_view type() const
The server type: "Unknown", "Standalone", "Mongos", "PossiblePrimary", "RSPrimary",...
#define MONGOCXX_DEPRECATED
Declares the associated entity as deprecated.
Definition export.hpp:25
#define MONGOCXX_ABI_EXPORT_CDECL(...)
Equivalent to MONGOCXX_ABI_EXPORT with MONGOCXX_ABI_CDECL.
Definition export.hpp:52
The mongocxx v_noabi macro guard postlude header.
The mongocxx v_noabi macro guard prelude header.
The top-level namespace within which all bsoncxx library entities are declared.
Declares entities whose ABI stability is guaranteed for documented symbols.
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 mongocxx::v1::events::server_description.
Provides bsoncxx::v_noabi::document::view.
Provides std::string_view-related polyfills for library API usage.
Declares mongocxx::v_noabi::events::server_description.