MongoDB C++ Driver mongocxx-3.10.1
Loading...
Searching...
No Matches
server_description.hpp
1// Copyright 2018-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>
18
19#include <bsoncxx/document/view.hpp>
20#include <bsoncxx/stdx/string_view.hpp>
21
22#include <mongocxx/config/prelude.hpp>
23
24namespace mongocxx {
25namespace v_noabi {
26namespace events {
27
32 public:
33 MONGOCXX_PRIVATE explicit server_description(const void* event);
34
39
46 std::uint32_t id() const;
47
53 std::int64_t round_trip_time() const;
54
61 bsoncxx::v_noabi::stdx::string_view type() const;
62
68 MONGOCXX_DEPRECATED bsoncxx::v_noabi::document::view is_master() const;
69
77
83 bsoncxx::v_noabi::stdx::string_view host() const;
84
90 std::uint16_t port() const;
91
92 private:
93 const void* _sd;
94};
95
96} // namespace events
97} // namespace v_noabi
98} // namespace mongocxx
99
100#include <mongocxx/config/postlude.hpp>
A read-only, non-owning view of a BSON document.
Definition view.hpp:35
Class representing what the driver knows about a MongoDB server.
Definition server_description.hpp:31
std::uint16_t port() const
Returns the server port.
bsoncxx::v_noabi::document::view is_master() const
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...
std::uint32_t id() const
An opaque id, unique to this server for this mongocxx::v_noabi::client or mongocxx::v_noabi::pool.
bsoncxx::v_noabi::stdx::string_view host() const
Returns the server host name.
~server_description()
Destroys a server_description.
bsoncxx::v_noabi::stdx::string_view type() const
The server type: "Unknown", "Standalone", "Mongos", "PossiblePrimary", "RSPrimary",...
The top-level namespace for mongocxx library entities.
Definition bulk_write-fwd.hpp:19