|
Fawkes API
Fawkes Development Version
|
Client configuration. More...
#include <mongodb_client_config.h>
Public Types | |
| enum | ConnectionMode { CONNECTION , REPLICA_SET } |
| Connection mode enumeration. More... | |
Public Member Functions | |
| MongoDBClientConfig (fawkes::Configuration *config, fawkes::Logger *logger, std::string cfgname, std::string prefix) | |
| Constructor. More... | |
| mongocxx::client * | create_client () |
| Create MongoDB client for this configuration. More... | |
| bool | is_enabled () const |
| Check if configuration is enabled. More... | |
| std::string | hostport () const |
| Get host and port of configuration. More... | |
| void | log (fawkes::Logger *logger, const char *component, const char *indent) |
| Write client configuration information to log. More... | |
| ConnectionMode | mode () const |
| Get client configuration mode. More... | |
Client configuration.
MongoDB Client Configuration.
Instances of this class represent a single MongoDB client configuration used to initiate connections.
Definition at line 36 of file mongodb_client_config.h.
Connection mode enumeration.
| Enumerator | |
|---|---|
| CONNECTION | connect to single node |
| REPLICA_SET | connect to replica set |
Definition at line 40 of file mongodb_client_config.h.
| MongoDBClientConfig::MongoDBClientConfig | ( | fawkes::Configuration * | config, |
| fawkes::Logger * | logger, | ||
| std::string | cfgname, | ||
| std::string | prefix | ||
| ) |
Constructor.
This will read the given configuration.
| config | configuration to query |
| logger | logger for info messages |
| cfgname | configuration name |
| prefix | configuration path prefix |
Definition at line 47 of file mongodb_client_config.cpp.
References fawkes::Configuration::get_bool(), fawkes::Configuration::get_string(), fawkes::Configuration::get_strings(), fawkes::Configuration::get_uint(), and fawkes::MultiLogger::log_info().
| mongocxx::client * MongoDBClientConfig::create_client | ( | ) |
Create MongoDB client for this configuration.
Definition at line 151 of file mongodb_client_config.cpp.
Referenced by MongoDBReplicaSetConfig::init().
| std::string MongoDBClientConfig::hostport | ( | ) | const |
Get host and port of configuration.
Definition at line 193 of file mongodb_client_config.cpp.
Referenced by MongoDBReplicaSetConfig::init().
|
inline |
Check if configuration is enabled.
Definition at line 55 of file mongodb_client_config.h.
Referenced by MongoDBReplicaSetConfig::init().
| void MongoDBClientConfig::log | ( | fawkes::Logger * | logger, |
| const char * | component, | ||
| const char * | indent | ||
| ) |
Write client configuration information to log.
| logger | logger to write to |
| component | component to pass to logger |
| indent | indentation to put before each string |
Definition at line 170 of file mongodb_client_config.cpp.
References fawkes::MultiLogger::log_info().
| MongoDBClientConfig::ConnectionMode MongoDBClientConfig::mode | ( | ) | const |
Get client configuration mode.
Definition at line 208 of file mongodb_client_config.cpp.
Referenced by MongoDBReplicaSetConfig::init().