
CreateInstance() (renamed from initMonitor()) and destroyInstance() (renamed from finishMonitor()) have now tentatively been implemented for all monitors. Next step is to 1) change the prototype of startMonitor() to bool (*startMonitor)(MXS_SPECIFIC_MONITOR*, const MXS_MONITOR_PARAMETER*); and assume that mon->handle will always contain the instance, 2) not delete any data in stopMonitor(), 3) add monitorCreateAll() that calls createInstance() for all monitors (and call that in main()), and 4) add monitorDestroyAll() that calls destroyInstance() for all monitors (and call that in main()).
34 lines
1.3 KiB
C
34 lines
1.3 KiB
C
#pragma once
|
|
|
|
/*
|
|
* Copyright (c) 2016 MariaDB Corporation Ab
|
|
*
|
|
* Use of this software is governed by the Business Source License included
|
|
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
|
|
*
|
|
* Change Date: 2020-01-01
|
|
*
|
|
* On the date above, in accordance with the Business Source License, use
|
|
* of this software will be governed by version 2 or later of the General
|
|
* Public License.
|
|
*/
|
|
|
|
#include <maxscale/monitor.h>
|
|
#include <maxscale/spinlock.h>
|
|
#include <maxscale/thread.h>
|
|
|
|
// The handle for an instance of a NDB Cluster Monitor module
|
|
struct NDBC_MONITOR : public MXS_SPECIFIC_MONITOR
|
|
{
|
|
THREAD thread; /**< Monitor thread */
|
|
SPINLOCK lock; /**< The monitor spinlock */
|
|
unsigned long id; /**< Monitor ID */
|
|
uint64_t events; /**< enabled events */
|
|
int shutdown; /**< Flag to shutdown the monitor thread */
|
|
int status; /**< Monitor status */
|
|
MXS_MONITORED_SERVER *master; /**< Master server for MySQL Master/Slave replication */
|
|
char* script; /**< Script to call when state changes occur on servers */
|
|
MXS_MONITOR* monitor; /**< Pointer to generic monitor structure */
|
|
bool checked; /**< Whether server access has been checked */
|
|
};
|