MySQL 9.0.0
Source Code Documentation
|
Retrieve and manage plugin configuration. More...
#include <plugin_config.h>
Public Member Functions | |
BasePluginConfig ()=default | |
BasePluginConfig (const BasePluginConfig &)=default | |
BasePluginConfig (BasePluginConfig &&)=default | |
BasePluginConfig & | operator= (const BasePluginConfig &)=default |
BasePluginConfig & | operator= (BasePluginConfig &&)=default |
virtual | ~BasePluginConfig ()=default |
destructor More... | |
std::string | get_option_description (const mysql_harness::ConfigSection *section, std::string_view option) const |
get description of the option. More... | |
virtual std::string | get_default (std::string_view option) const =0 |
Gets the default for the given option. More... | |
virtual bool | is_required (std::string_view option) const =0 |
Returns whether the given option is required. More... | |
template<class Func > | |
decltype(auto) | get_option (const mysql_harness::ConfigSection *section, std::string_view option, Func &&transformer) const |
get option value. More... | |
template<class Func > | |
decltype(auto) | get_option_no_default (const mysql_harness::ConfigSection *section, std::string_view option, Func &&transformer) const |
get option value. More... | |
std::string | get_option_string (const mysql_harness::ConfigSection *section, std::string_view option) const |
Gets value of given option as string. More... | |
template<class T > | |
T | get_uint_option (const mysql_harness::ConfigSection *section, std::string_view option, T min_value=0, T max_value=std::numeric_limits< T >::max()) const |
Gets an unsigned integer using the given option. More... | |
std::chrono::milliseconds | get_option_milliseconds (const mysql_harness::ConfigSection *section, std::string_view option, double min_value=0.0, double max_value=std::numeric_limits< double >::max()) const |
Gets a number of milliseconds using the given option. More... | |
Protected Member Functions | |
BasePluginConfig (const mysql_harness::ConfigSection *section) | |
Constructor for derived classes. More... | |
Static Protected Member Functions | |
static std::string | get_section_name (const mysql_harness::ConfigSection *section) |
Generate the name for this configuration. More... | |
Private Member Functions | |
std::optional< std::string > | get_option_string_ (const mysql_harness::ConfigSection *section, std::string_view option) const |
get value of an option from a config-section. More... | |
std::string | get_option_string_or_default_ (const mysql_harness::ConfigSection *section, std::string_view option) const |
get value of an option from a config-section. More... | |
Private Attributes | |
std::string | section_name_ |
Name of the section. More... | |
Retrieve and manage plugin configuration.
BasePluginConfig is an abstract class which can be used to by plugins to derive their own class retrieving configuration from, for example, Harness ConfigSection instances
.
|
default |
|
default |
|
default |
|
virtualdefault |
destructor
|
inlineprotected |
Constructor for derived classes.
|
pure virtual |
Gets the default for the given option.
Gets the default value of the given option. If no default option is available, an empty string is returned.
option | name of the option |
Implemented in ConnectionPoolPluginConfig, DestinationStatusPluginConfig, anonymous_namespace{http_auth_backend_plugin.cc}::HtpasswdPluginConfig, HttpAuthRealmPluginConfig, HttpServerPluginConfig, IoPluginConfig, MetadataCachePluginConfig, PluginConfig, RoutingPluginConfig, anonymous_namespace{logger_plugin.cc}::LoggingPluginConfig, anonymous_namespace{http_auth_backend_plugin.cc}::PluginConfig, RestApiPluginConfig, RestConnectionPoolPluginConfig, RestMetadataCachePluginConfig, RestRouterPluginConfig, and RestRoutingPluginConfig.
|
inline |
get option value.
gets the option from a config-section (or its default value if it doesn't exist) and converts it with a transformation function.
section | configuration section |
option | name of the option |
transformer | transformation function. The signature of the transformation function should be equivalent to: (const std::string &value, const std::string &option_description) and returns the transformed value. |
std::string mysql_harness::BasePluginConfig::get_option_description | ( | const mysql_harness::ConfigSection * | section, |
std::string_view | option | ||
) | const |
get description of the option.
For example, option wait_timeout in section [routing:homepage] will return a prefix (without quotes):
option wait_timeout in [routing:homepage]
section | configuration section |
option | Name of the option |
|
inline |
Gets a number of milliseconds using the given option.
The expected option value is a string with floating point number in seconds (with '.' as a decimal separator) in standard or scientific notation
section | Instance of ConfigSection |
option | Option name in section |
min_value | Minimum value |
max_value | Maximum value |
std::invalid_argument | on errors |
|
inline |
get option value.
gets the option from a config-section and converts it with a transformation function.
does not call get_default().
section | configuration section |
option | name of the option |
transformer | transformation function. The signature of the transformation function should be equivalent to: (const std::string &value, const std::string &option_description) and returns the transformed value. |
|
inline |
Gets value of given option as string.
option_not_present | if the required option is missing |
option_empty | if the required option is present but empty |
section | Instance of ConfigSection |
option | name of the option |
|
private |
get value of an option from a config-section.
does not call get_default()
|
private |
get value of an option from a config-section.
gets value from get_default() if the option-value is not present or empty.
|
staticprotected |
Generate the name for this configuration.
section | Instance of ConfigSection |
|
inline |
Gets an unsigned integer using the given option.
Gets an unsigned integer using the given option. The type can be any unsigned integer type such as uint16_t.
The min_value argument can be used to set a minimum value for the option. For example, when 0 (zero) is not allowed, min_value can be set to 0. The maximum value is whatever the maximum of the use type is.
Throws std::invalid_argument on errors.
section | Instance of ConfigSection |
option | Option name in section |
min_value | Minimum value |
max_value | Maximum value |
|
pure virtual |
Returns whether the given option is required.
Implemented in anonymous_namespace{http_auth_backend_plugin.cc}::PluginConfig, HttpAuthRealmPluginConfig, MetadataCachePluginConfig, PluginConfig, RestConnectionPoolPluginConfig, RestMetadataCachePluginConfig, RestRouterPluginConfig, RestRoutingPluginConfig, RoutingPluginConfig, ConnectionPoolPluginConfig, DestinationStatusPluginConfig, anonymous_namespace{logger_plugin.cc}::LoggingPluginConfig, anonymous_namespace{http_auth_backend_plugin.cc}::HtpasswdPluginConfig, HttpServerPluginConfig, IoPluginConfig, and RestApiPluginConfig.
|
default |
|
default |
|
private |
Name of the section.