MXS-2556 Make config::Configuration aware of its object

The name of the object (i.e. the section name from the configuration
file), is now stored in the configuration object for that object.

That way, more contextual and hence morfe user friendly errors and
warnings can be generated.
This commit is contained in:
Johan Wikman
2019-06-11 11:05:15 +03:00
parent df5377f135
commit 04fdaf1fdb
11 changed files with 37 additions and 20 deletions

View File

@ -190,8 +190,8 @@ sqlite3* open_or_create_db(const std::string& path)
}
}
ClustrixMonitor::Config::Config()
: m_configuration(&clustrixmon::specification)
ClustrixMonitor::Config::Config(const std::string& name)
: m_configuration(name, &clustrixmon::specification)
, m_cluster_monitor_interval(&m_configuration, &clustrixmon::cluster_monitor_interval)
, m_health_check_threshold(&m_configuration, &clustrixmon::health_check_threshold)
, m_dynamic_node_detection(&m_configuration, &clustrixmon::dynamic_node_detection)
@ -212,6 +212,7 @@ bool ClustrixMonitor::Config::configure(const MXS_CONFIG_PARAMETER& params)
ClustrixMonitor::ClustrixMonitor(const string& name, const string& module, sqlite3* pDb)
: MonitorWorker(name, module)
, m_config(name)
, m_pDb(pDb)
{
}