MXS-1775 Expose the state of the monitor

This commit is contained in:
Johan Wikman
2018-05-28 10:17:30 +03:00
parent ebcb807438
commit a55019774d
2 changed files with 27 additions and 9 deletions

View File

@ -28,6 +28,20 @@ public:
virtual ~MonitorInstance();
/**
* @brief Current state of the monitor.
*
* Note that in principle the state of the monitor may already have
* changed when the current state is returned. The state can be fully
* trusted only if it is asked in a context when it is known that nobody
* else can affect it.
*
* @return @c MXS_MONITOR_RUNNING if the monitor is running,
* @c MXS_MONITOR_STOPPING if the monitor is stopping, and
* @c MXS_MONITOR_STOPPED of the monitor is stopped.
*/
int32_t state() const;
/**
* @brief Starts the monitor.
*
@ -143,7 +157,7 @@ protected:
MXS_MONITORED_SERVER* m_master; /**< Master server */
private:
int32_t m_status; /**< The current status of the monitor. */
int32_t m_state; /**< The current state of the monitor. */
THREAD m_thread; /**< The thread handle of the monitoring thread. */
int32_t m_shutdown; /**< Non-zero if the monitor should shut down. */
bool m_checked; /**< Whether server access has been checked. */