MongoDB C++ Driver  mongocxx-3.6.2
All Classes Namespaces Functions Typedefs Enumerations Enumerator Friends Pages
apm.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 <functional>
18 
19 #include <mongocxx/events/command_failed_event.hpp>
20 #include <mongocxx/events/command_started_event.hpp>
21 #include <mongocxx/events/command_succeeded_event.hpp>
22 #include <mongocxx/events/heartbeat_failed_event.hpp>
23 #include <mongocxx/events/heartbeat_started_event.hpp>
24 #include <mongocxx/events/heartbeat_succeeded_event.hpp>
25 #include <mongocxx/events/server_changed_event.hpp>
26 #include <mongocxx/events/server_closed_event.hpp>
27 #include <mongocxx/events/server_opening_event.hpp>
28 #include <mongocxx/events/topology_changed_event.hpp>
29 #include <mongocxx/events/topology_closed_event.hpp>
30 #include <mongocxx/events/topology_opening_event.hpp>
31 
32 #include <mongocxx/config/prelude.hpp>
33 
34 namespace mongocxx {
35 MONGOCXX_INLINE_NAMESPACE_BEGIN
36 namespace options {
37 
38 class MONGOCXX_API apm {
39  public:
52  std::function<void(const mongocxx::events::command_started_event&)> command_started);
53 
59  const std::function<void(const mongocxx::events::command_started_event&)>& command_started()
60  const;
61 
74  std::function<void(const mongocxx::events::command_failed_event&)> command_failed);
75 
81  const std::function<void(const mongocxx::events::command_failed_event&)>& command_failed()
82  const;
83 
96  std::function<void(const mongocxx::events::command_succeeded_event&)> command_succeeded);
97 
104  const;
105 
118  std::function<void(const mongocxx::events::server_opening_event&)> server_opening);
119 
125  const std::function<void(const mongocxx::events::server_opening_event&)>& server_opening()
126  const;
127 
140  std::function<void(const mongocxx::events::server_closed_event&)> server_closed);
141 
147  const std::function<void(const mongocxx::events::server_closed_event&)>& server_closed() const;
148 
162  std::function<void(const mongocxx::events::server_changed_event&)> server_changed);
163 
169  const std::function<void(const mongocxx::events::server_changed_event&)>& server_changed()
170  const;
171 
184  std::function<void(const mongocxx::events::topology_opening_event&)> topology_opening);
185 
191  const std::function<void(const mongocxx::events::topology_opening_event&)>& topology_opening()
192  const;
193 
206  std::function<void(const mongocxx::events::topology_closed_event&)> topology_closed);
207 
213  const std::function<void(const mongocxx::events::topology_closed_event&)>& topology_closed()
214  const;
215 
230  std::function<void(const mongocxx::events::topology_changed_event&)> topology_changed);
231 
237  const std::function<void(const mongocxx::events::topology_changed_event&)>& topology_changed()
238  const;
239 
252  std::function<void(const mongocxx::events::heartbeat_started_event&)> heartbeat_started);
253 
260  const;
261 
274  std::function<void(const mongocxx::events::heartbeat_failed_event&)> heartbeat_failed);
275 
281  const std::function<void(const mongocxx::events::heartbeat_failed_event&)>& heartbeat_failed()
282  const;
283 
297  std::function<void(const mongocxx::events::heartbeat_succeeded_event&)>
298  heartbeat_succeeded);
299 
305  const std::function<void(const mongocxx::events::heartbeat_succeeded_event&)>&
307 
308  private:
309  std::function<void(const mongocxx::events::command_started_event&)> _command_started;
310  std::function<void(const mongocxx::events::command_failed_event&)> _command_failed;
311  std::function<void(const mongocxx::events::command_succeeded_event&)> _command_succeeded;
312  std::function<void(const mongocxx::events::server_closed_event&)> _server_closed;
313  std::function<void(const mongocxx::events::server_changed_event&)> _server_changed;
314  std::function<void(const mongocxx::events::server_opening_event&)> _server_opening;
315  std::function<void(const mongocxx::events::topology_closed_event&)> _topology_closed;
316  std::function<void(const mongocxx::events::topology_changed_event&)> _topology_changed;
317  std::function<void(const mongocxx::events::topology_opening_event&)> _topology_opening;
318  std::function<void(const mongocxx::events::heartbeat_started_event&)> _heartbeat_started;
319  std::function<void(const mongocxx::events::heartbeat_failed_event&)> _heartbeat_failed;
320  std::function<void(const mongocxx::events::heartbeat_succeeded_event&)> _heartbeat_succeeded;
321 };
322 
323 } // namespace options
324 MONGOCXX_INLINE_NAMESPACE_END
325 } // namespace mongocxx
326 
327 #include <mongocxx/config/postlude.hpp>
mongocxx::events::heartbeat_started_event
An event notification sent when the driver begins executing an "isMaster" command to check the status...
Definition: heartbeat_started_event.hpp:33
mongocxx
Top level namespace for the MongoDB C++ driver.
Definition: bulk_write.hpp:24
mongocxx::events::heartbeat_failed_event
An event notification sent when the driver failed to send an "isMaster" command to check the status o...
Definition: heartbeat_failed_event.hpp:33
mongocxx::options::apm::server_changed
const std::function< void(const mongocxx::events::server_changed_event &)> & server_changed() const
Retrieves the server description changed monitoring callback.
mongocxx::options::apm::on_heartbeat_started
apm & on_heartbeat_started(std::function< void(const mongocxx::events::heartbeat_started_event &)> heartbeat_started)
Set the heartbeat started monitoring callback.
mongocxx::events::command_failed_event
An event notification sent when the driver fails to execute a MongoDB command.
Definition: command_failed_event.hpp:34
mongocxx::options::apm::topology_opening
const std::function< void(const mongocxx::events::topology_opening_event &)> & topology_opening() const
Retrieves the topology_opening monitoring callback.
mongocxx::options::apm::command_started
const std::function< void(const mongocxx::events::command_started_event &)> & command_started() const
Retrieves the command started monitoring callback.
mongocxx::options::apm::on_server_changed
apm & on_server_changed(std::function< void(const mongocxx::events::server_changed_event &)> server_changed)
Set the server description changed monitoring callback.
mongocxx::options::apm::on_command_failed
apm & on_command_failed(std::function< void(const mongocxx::events::command_failed_event &)> command_failed)
Set the command failed monitoring callback.
mongocxx::options::apm::on_topology_opening
apm & on_topology_opening(std::function< void(const mongocxx::events::topology_opening_event &)> topology_opening)
Set the topology_opening monitoring callback.
mongocxx::options::apm::on_server_closed
apm & on_server_closed(std::function< void(const mongocxx::events::server_closed_event &)> server_closed)
Set the server closed monitoring callback.
mongocxx::options::apm::topology_changed
const std::function< void(const mongocxx::events::topology_changed_event &)> & topology_changed() const
Retrieves the topology description changed monitoring callback.
mongocxx::events::topology_closed_event
An event notification sent when the driver stops monitoring a server topology and destroys its descri...
Definition: topology_closed_event.hpp:33
mongocxx::events::server_changed_event
An event notification sent when the driver observes a change in the status of a server it is connecte...
Definition: server_changed_event.hpp:35
mongocxx::events::server_closed_event
An event notification sent when the driver stops monitoring a MongoDB server and removes it from the ...
Definition: server_closed_event.hpp:34
mongocxx::events::command_succeeded_event
An event notification sent when the driver successfully executes a MongoDB command.
Definition: command_succeeded_event.hpp:34
mongocxx::options::apm::topology_closed
const std::function< void(const mongocxx::events::topology_closed_event &)> & topology_closed() const
Retrieves the topology closed monitoring callback.
mongocxx::options::apm::on_topology_changed
apm & on_topology_changed(std::function< void(const mongocxx::events::topology_changed_event &)> topology_changed)
Set the topology description changed monitoring callback.
mongocxx::options::apm::on_command_started
apm & on_command_started(std::function< void(const mongocxx::events::command_started_event &)> command_started)
Set the command started monitoring callback.
mongocxx::events::heartbeat_succeeded_event
An event notification sent when the driver completes an "isMaster" command to check the status of a s...
Definition: heartbeat_succeeded_event.hpp:34
mongocxx::options::apm
Definition: apm.hpp:38
mongocxx::events::server_opening_event
An event notification sent when the driver adds a MongoDB server to the topology description and begi...
Definition: server_opening_event.hpp:33
mongocxx::options::apm::heartbeat_started
const std::function< void(const mongocxx::events::heartbeat_started_event &)> & heartbeat_started() const
Retrieves the heartbeat started monitoring callback.
mongocxx::options::apm::command_failed
const std::function< void(const mongocxx::events::command_failed_event &)> & command_failed() const
Retrieves the command failed monitoring callback.
mongocxx::options::apm::on_heartbeat_succeeded
apm & on_heartbeat_succeeded(std::function< void(const mongocxx::events::heartbeat_succeeded_event &)> heartbeat_succeeded)
Set the heartbeat succeeded monitoring callback.
mongocxx::options::apm::server_opening
const std::function< void(const mongocxx::events::server_opening_event &)> & server_opening() const
Retrieves the server opening monitoring callback.
mongocxx::events::command_started_event
An event notification sent when the driver begins executing a MongoDB command.
Definition: command_started_event.hpp:34
mongocxx::options::apm::on_command_succeeded
apm & on_command_succeeded(std::function< void(const mongocxx::events::command_succeeded_event &)> command_succeeded)
Set the command succeeded monitoring callback.
mongocxx::events::topology_changed_event
An event notification sent when the driver observes a change in any of the servers it is connected to...
Definition: topology_changed_event.hpp:34
mongocxx::options::apm::on_heartbeat_failed
apm & on_heartbeat_failed(std::function< void(const mongocxx::events::heartbeat_failed_event &)> heartbeat_failed)
Set the heartbeat failed monitoring callback.
mongocxx::options::apm::command_succeeded
const std::function< void(const mongocxx::events::command_succeeded_event &)> & command_succeeded() const
Retrieves the command succeeded monitoring callback.
mongocxx::options::apm::heartbeat_succeeded
const std::function< void(const mongocxx::events::heartbeat_succeeded_event &)> & heartbeat_succeeded() const
Retrieves the heartbeat succeeded monitoring callback.
mongocxx::options::apm::on_server_opening
apm & on_server_opening(std::function< void(const mongocxx::events::server_opening_event &)> server_opening)
Set the server opening monitoring callback.
mongocxx::events::topology_opening_event
An event notification sent when the driver initializes a server topology.
Definition: topology_opening_event.hpp:33
mongocxx::options::apm::heartbeat_failed
const std::function< void(const mongocxx::events::heartbeat_failed_event &)> & heartbeat_failed() const
Retrieves the heartbeat failed monitoring callback.
mongocxx::options::apm::on_topology_closed
apm & on_topology_closed(std::function< void(const mongocxx::events::topology_closed_event &)> topology_closed)
Set the topology closed monitoring callback.
mongocxx::options::apm::server_closed
const std::function< void(const mongocxx::events::server_closed_event &)> & server_closed() const
Retrieves the server closed monitoring callback.