MXS-1775 Introduce MonitorInstance::configure() function

The configuring of the monitor instance is now performed in a
separate function. That is in preparation for the moving of the
start function to maxscale::MonitorInstance.
This commit is contained in:
Johan Wikman
2018-05-16 11:35:24 +03:00
parent bcb7d09a15
commit 3606a5ed1c
12 changed files with 93 additions and 25 deletions

View File

@ -121,6 +121,10 @@ bool MMMonitor::start(const MXS_CONFIG_PARAMETER *params)
{
bool started = false;
ss_dassert(!m_shutdown);
ss_dassert(!m_thread);
ss_dassert(!m_script);
if (!m_checked)
{
if (!check_monitor_permissions(m_monitor, "SHOW SLAVE STATUS"))
@ -135,9 +139,7 @@ bool MMMonitor::start(const MXS_CONFIG_PARAMETER *params)
if (m_checked)
{
m_detectStaleMaster = config_get_bool(params, "detect_stale_master");
m_script = config_copy_string(params, "script");
m_events = config_get_enum(params, "events", mxs_monitor_event_enum_values);
configure(params);
if (thread_start(&m_thread, &maxscale::MonitorInstance::main, this, 0) == NULL)
{
@ -154,6 +156,13 @@ bool MMMonitor::start(const MXS_CONFIG_PARAMETER *params)
return started;
}
void MMMonitor::configure(const MXS_CONFIG_PARAMETER* params)
{
m_script = config_copy_string(params, "script");
m_events = config_get_enum(params, "events", mxs_monitor_event_enum_values);
m_detectStaleMaster = config_get_bool(params, "detect_stale_master");
}
/**
* Diagnostic interface
*