MXS-1775 Introduce maxscale::MonitorInstance

- All monitors (but MariaDBMon for the time being) inherit
  from that.
- All common member variables moved to that class. Still
  manipulated in derived classes.

In subsequent commits common functionality will be moved to
that class.
This commit is contained in:
Johan Wikman
2018-05-16 10:58:17 +03:00
parent 787a0b50ef
commit 3c277f4e5e
12 changed files with 56 additions and 73 deletions

View File

@ -14,10 +14,31 @@
#include <maxscale/cppdefs.hh>
#include <maxscale/monitor.h>
#include <maxscale/thread.h>
namespace maxscale
{
class MonitorInstance : public MXS_MONITOR_INSTANCE
{
public:
MonitorInstance(const MonitorInstance&) = delete;
MonitorInstance& operator = (const MonitorInstance&) = delete;
virtual ~MonitorInstance();
protected:
MonitorInstance(MXS_MONITOR* pMonitor);
int m_status; /**< The current status of the monitor. */
THREAD m_thread; /**< The thread handle of the monitoring thread. */
MXS_MONITOR* m_monitor; /**< The generic monitor structure. */
int32_t m_shutdown; /**< Non-zero if the monitor should shut down. */
char* m_script; /**< Launchable script. */
uint64_t m_events; /**< Enabled monitor events. */
bool m_checked; /**< Whether server access has been checked. */
};
/**
* The purpose of the template MonitorApi is to provide an implementation
* of the monitor C-API. The template is instantiated with a class that