MySQL 8.4.2
Source Code Documentation
|
Respresents the current Router configuration. More...
#include <dynamic_config.h>
Classes | |
struct | SectionConfig |
Public Types | |
enum class | ValueType { ConfiguredValue , DefaultForCluster , DefaultForClusterSet } |
Type of the options stored in the dynamic configuration object. More... | |
using | OptionName = std::string |
using | OptionValue = std::variant< std::monostate, int64_t, bool, double, std::string > |
using | SectionId = std::pair< std::string, std::string > |
using | SectionOptions = std::map< OptionName, OptionValue > |
using | JsonAllocator = rapidjson::CrtAllocator |
using | JsonDocument = rapidjson::GenericDocument< rapidjson::UTF8<>, JsonAllocator > |
Public Member Functions | |
void | set_option_configured (const SectionId §ion_id, std::string_view option_name, const OptionValue &value) |
Sets a given option in a given section to a specific value. More... | |
void | set_option_default (const SectionId §ion_id, std::string_view option_name, const OptionValue &default_value_cluster, const OptionValue &default_value_clusterset) |
Sets a default for an option in a given section to a specific value. More... | |
void | set_option_default (const SectionId §ion_id, std::string_view option_name, const OptionValue &default_value) |
Sets a default for an option in a given section to a specific value. More... | |
JsonDocument | get_json (const ValueType value_type) const |
Return the current configuration options and their values stored in the dynamic configuration object. More... | |
std::string | get_json_as_string (const ValueType value_type) const |
Return the current configuration options and their values stored in the dynamic configuration object as a string. More... | |
void | clear () |
Clear the DynamicConfig object (remove all registered sections with their option values and defaults). More... | |
Static Public Member Functions | |
static DynamicConfig & | instance () |
Returns a singleton object of DynamicConfig class. More... | |
Private Types | |
using | Config = std::map< SectionId, SectionConfig > |
Private Member Functions | |
DynamicConfig ()=default | |
DynamicConfig (const DynamicConfig &)=delete | |
DynamicConfig & | operator= (const DynamicConfig &)=delete |
void | set_option (const ValueType value_type, const SectionId §ion_id, std::string_view option_name, const OptionValue &value) |
Config & | get_config (const ValueType value_type) |
Config const & | get_config (const ValueType value_type) const |
Private Attributes | |
Config | configured_ |
Config | defaults_cluster_ |
Config | defaults_clusterset_ |
Respresents the current Router configuration.
It is initialized at start with the defaults and configuration from the configuration file(s).
|
private |
using mysql_harness::DynamicConfig::JsonAllocator = rapidjson::CrtAllocator |
using mysql_harness::DynamicConfig::JsonDocument = rapidjson::GenericDocument<rapidjson::UTF8<>, JsonAllocator> |
using mysql_harness::DynamicConfig::OptionName = std::string |
using mysql_harness::DynamicConfig::OptionValue = std::variant<std::monostate, int64_t, bool, double, std::string> |
using mysql_harness::DynamicConfig::SectionId = std::pair<std::string, std::string> |
using mysql_harness::DynamicConfig::SectionOptions = std::map<OptionName, OptionValue> |
|
strong |
|
privatedefault |
|
privatedelete |
void mysql_harness::DynamicConfig::clear | ( | ) |
Clear the DynamicConfig object (remove all registered sections with their option values and defaults).
|
private |
|
private |
JsonDocument mysql_harness::DynamicConfig::get_json | ( | const ValueType | value_type | ) | const |
Return the current configuration options and their values stored in the dynamic configuration object.
value_type | type of the options to be returned |
std::string mysql_harness::DynamicConfig::get_json_as_string | ( | const ValueType | value_type | ) | const |
Return the current configuration options and their values stored in the dynamic configuration object as a string.
value_type | type of the options to be returned |
|
static |
Returns a singleton object of DynamicConfig class.
|
privatedelete |
|
private |
void mysql_harness::DynamicConfig::set_option_configured | ( | const SectionId & | section_id, |
std::string_view | option_name, | ||
const OptionValue & | value | ||
) |
Sets a given option in a given section to a specific value.
section_id | identifier of a section for this operation |
option_name | name of the option inside a section for this operation |
value | value to be set |
void mysql_harness::DynamicConfig::set_option_default | ( | const SectionId & | section_id, |
std::string_view | option_name, | ||
const OptionValue & | default_value | ||
) |
Sets a default for an option in a given section to a specific value.
Overload for more common case when cluster and clusterset values are the same.
section_id | identifier of a section for this operation |
option_name | name of the option inside a section for this operation |
default_value | default value for both srtandalne cluster and clusterset setup to be set |
void mysql_harness::DynamicConfig::set_option_default | ( | const SectionId & | section_id, |
std::string_view | option_name, | ||
const OptionValue & | default_value_cluster, | ||
const OptionValue & | default_value_clusterset | ||
) |
Sets a default for an option in a given section to a specific value.
section_id | identifier of a section for this operation |
option_name | name of the option inside a section for this operation |
default_value_cluster | default value for srtandalne cluster setup to be set |
default_value_clusterset | default value for the clusterset setup to be set |
|
private |
|
private |
|
private |