Format config.cc and config_runtime.cc
This commit is contained in:
@ -1932,14 +1932,14 @@ uint64_t MXS_CONFIG_PARAMETER::get_size(const std::string& key) const
|
|||||||
return intval;
|
return intval;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::chrono::milliseconds
|
std::chrono::milliseconds MXS_CONFIG_PARAMETER::get_duration(const std::string& key,
|
||||||
MXS_CONFIG_PARAMETER::get_duration(const std::string& key,
|
mxs::config::DurationInterpretation interpretation)
|
||||||
mxs::config::DurationInterpretation interpretation) const
|
const
|
||||||
{
|
{
|
||||||
string value = get_string(key);
|
string value = get_string(key);
|
||||||
std::chrono::milliseconds duration { 0 };
|
std::chrono::milliseconds duration {0};
|
||||||
MXB_AT_DEBUG(bool rval = ) get_suffixed_duration(value.c_str(), interpretation, &duration);
|
MXB_AT_DEBUG(bool rval = ) get_suffixed_duration(value.c_str(), interpretation, &duration);
|
||||||
mxb_assert(rval); // When this function is called, the validity of the value should have been checked.
|
mxb_assert(rval); // When this function is called, the validity of the value should have been checked.
|
||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2015,9 +2015,8 @@ char* MXS_CONFIG_PARAMETER::get_c_str_copy(const string& key) const
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<pcre2_code>
|
std::unique_ptr<pcre2_code> MXS_CONFIG_PARAMETER::get_compiled_regex(const string& key, uint32_t options,
|
||||||
MXS_CONFIG_PARAMETER::get_compiled_regex(const string& key, uint32_t options,
|
uint32_t* output_ovec_size) const
|
||||||
uint32_t* output_ovec_size) const
|
|
||||||
{
|
{
|
||||||
auto regex_string = get_string(key);
|
auto regex_string = get_string(key);
|
||||||
std::unique_ptr<pcre2_code> code;
|
std::unique_ptr<pcre2_code> code;
|
||||||
@ -2032,9 +2031,11 @@ MXS_CONFIG_PARAMETER::get_compiled_regex(const string& key, uint32_t options,
|
|||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<pcre2_code>>
|
std::vector<std::unique_ptr<pcre2_code>> MXS_CONFIG_PARAMETER::get_compiled_regexes(
|
||||||
MXS_CONFIG_PARAMETER::get_compiled_regexes(const std::vector<string>& keys, uint32_t options,
|
const std::vector<string>& keys,
|
||||||
uint32_t* ovec_size_out, bool* compile_error_out)
|
uint32_t options,
|
||||||
|
uint32_t* ovec_size_out,
|
||||||
|
bool* compile_error_out)
|
||||||
{
|
{
|
||||||
std::vector<std::unique_ptr<pcre2_code>> rval;
|
std::vector<std::unique_ptr<pcre2_code>> rval;
|
||||||
bool compile_error = false;
|
bool compile_error = false;
|
||||||
@ -3008,7 +3009,7 @@ void config_set_global_defaults()
|
|||||||
* @return True if at least one of the required parameters is missing
|
* @return True if at least one of the required parameters is missing
|
||||||
*/
|
*/
|
||||||
static bool missing_required_parameters(const MXS_MODULE_PARAM* mod_params,
|
static bool missing_required_parameters(const MXS_MODULE_PARAM* mod_params,
|
||||||
const MXS_CONFIG_PARAMETER& params,
|
const MXS_CONFIG_PARAMETER& params,
|
||||||
const char* name)
|
const char* name)
|
||||||
{
|
{
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
@ -5017,7 +5018,7 @@ bool get_suffixed_duration(const char* zValue,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (*zEnd == 0)
|
if (*zEnd == 0)
|
||||||
{
|
{
|
||||||
@ -5124,7 +5125,7 @@ std::string generate_config_string(const std::string& instance_name, const MXS_C
|
|||||||
const MXS_MODULE_PARAM* common_param_defs,
|
const MXS_MODULE_PARAM* common_param_defs,
|
||||||
const MXS_MODULE_PARAM* module_param_defs)
|
const MXS_MODULE_PARAM* module_param_defs)
|
||||||
{
|
{
|
||||||
string output = "[" + instance_name + "]\n";;
|
string output = "[" + instance_name + "]\n";
|
||||||
// Common params and module params are null-terminated arrays. Loop over both and print parameter
|
// Common params and module params are null-terminated arrays. Loop over both and print parameter
|
||||||
// names and values.
|
// names and values.
|
||||||
for (auto param_set : {common_param_defs, module_param_defs})
|
for (auto param_set : {common_param_defs, module_param_defs})
|
||||||
|
@ -108,8 +108,8 @@ static const MXS_MODULE_PARAM* get_type_parameters(const char* type)
|
|||||||
* @return Whether loading succeeded and the list of default parameters
|
* @return Whether loading succeeded and the list of default parameters
|
||||||
*/
|
*/
|
||||||
static std::pair<bool, MXS_CONFIG_PARAMETER> load_defaults(const char* name,
|
static std::pair<bool, MXS_CONFIG_PARAMETER> load_defaults(const char* name,
|
||||||
const char* module_type,
|
const char* module_type,
|
||||||
const char* object_type)
|
const char* object_type)
|
||||||
{
|
{
|
||||||
bool rval;
|
bool rval;
|
||||||
MXS_CONFIG_PARAMETER params;
|
MXS_CONFIG_PARAMETER params;
|
||||||
@ -306,7 +306,7 @@ bool runtime_create_server(const char* name,
|
|||||||
const char* port,
|
const char* port,
|
||||||
const char* protocol,
|
const char* protocol,
|
||||||
const char* authenticator,
|
const char* authenticator,
|
||||||
bool external)
|
bool external)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> guard(crt_lock);
|
std::lock_guard<std::mutex> guard(crt_lock);
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
@ -698,7 +698,7 @@ bool do_alter_monitor(Monitor* monitor, const char* key, const char* value)
|
|||||||
{
|
{
|
||||||
// Configure failed, restore original configs. This should not fail.
|
// Configure failed, restore original configs. This should not fail.
|
||||||
// TODO: add a flag to monitor which prevents startup if config is wrong.
|
// TODO: add a flag to monitor which prevents startup if config is wrong.
|
||||||
MXB_AT_DEBUG(bool check =) monitor->configure(&originals);
|
MXB_AT_DEBUG(bool check = ) monitor->configure(&originals);
|
||||||
mxb_assert(check);
|
mxb_assert(check);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
Reference in New Issue
Block a user