Update monitor APIs
No need to use void* as the types of the arguments in the monitor functions as the types are known and will always be the same.
This commit is contained in:
parent
edb5236e2c
commit
3eb25df676
@ -68,11 +68,15 @@
|
||||
* unregisterServer is called to remove a server from the set of servers that need to be
|
||||
* monitored.
|
||||
*/
|
||||
|
||||
struct monitor;
|
||||
typedef struct monitor MONITOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *(*startMonitor)(void *, void*);
|
||||
void (*stopMonitor)(void *);
|
||||
void (*diagnostics)(DCB *, void *);
|
||||
void *(*startMonitor)(MONITOR *monitor, const CONFIG_PARAMETER *params);
|
||||
void (*stopMonitor)(MONITOR *monitor);
|
||||
void (*diagnostics)(DCB *, const MONITOR *);
|
||||
} MONITOR_OBJECT;
|
||||
|
||||
/**
|
||||
|
@ -58,9 +58,9 @@ MODULE_INFO info =
|
||||
};
|
||||
/*lint +e14 */
|
||||
|
||||
static void *startMonitor(void *, void*);
|
||||
static void stopMonitor(void *);
|
||||
static void diagnostics(DCB *, void *);
|
||||
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER *params);
|
||||
static void stopMonitor(MONITOR *);
|
||||
static void diagnostics(DCB *, const MONITOR *);
|
||||
static MONITOR_SERVERS *get_candidate_master(MONITOR*);
|
||||
static MONITOR_SERVERS *set_cluster_master(MONITOR_SERVERS *, MONITOR_SERVERS *, int);
|
||||
static void disableMasterFailback(void *, int);
|
||||
@ -124,11 +124,9 @@ GetModuleObject()
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg, void* opt)
|
||||
startMonitor(MONITOR *mon, const CONFIG_PARAMETER *params)
|
||||
{
|
||||
MONITOR* mon = arg;
|
||||
GALERA_MONITOR *handle = mon->handle;
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*) opt;
|
||||
bool have_events = false, script_error = false;
|
||||
if (handle != NULL)
|
||||
{
|
||||
@ -234,9 +232,8 @@ startMonitor(void *arg, void* opt)
|
||||
* @param arg Handle on thr running monior
|
||||
*/
|
||||
static void
|
||||
stopMonitor(void *arg)
|
||||
stopMonitor(MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
GALERA_MONITOR *handle = (GALERA_MONITOR *) mon->handle;
|
||||
|
||||
handle->shutdown = 1;
|
||||
@ -250,10 +247,9 @@ stopMonitor(void *arg)
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static void
|
||||
diagnostics(DCB *dcb, void *arg)
|
||||
diagnostics(DCB *dcb, const MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
GALERA_MONITOR *handle = (GALERA_MONITOR *) mon->handle;
|
||||
const GALERA_MONITOR *handle = (const GALERA_MONITOR *) mon->handle;
|
||||
MONITOR_SERVERS *db;
|
||||
char *sep;
|
||||
|
||||
|
@ -46,9 +46,9 @@ MODULE_INFO info =
|
||||
};
|
||||
/*lint +e14 */
|
||||
|
||||
static void *startMonitor(void *, void*);
|
||||
static void stopMonitor(void *);
|
||||
static void diagnostics(DCB *, void *);
|
||||
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER *);
|
||||
static void stopMonitor(MONITOR *);
|
||||
static void diagnostics(DCB *, const MONITOR *);
|
||||
static void detectStaleMaster(void *, int);
|
||||
static MONITOR_SERVERS *get_current_master(MONITOR *);
|
||||
static bool isMySQLEvent(monitor_event_t event);
|
||||
@ -109,11 +109,9 @@ GetModuleObject()
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg, void* opt)
|
||||
startMonitor(MONITOR *mon, const CONFIG_PARAMETER *params)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MM_MONITOR *handle = mon->handle;
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*) opt;
|
||||
bool have_events = false, script_error = false;
|
||||
|
||||
if (handle)
|
||||
@ -203,9 +201,8 @@ startMonitor(void *arg, void* opt)
|
||||
* @param arg Handle on thr running monior
|
||||
*/
|
||||
static void
|
||||
stopMonitor(void *arg)
|
||||
stopMonitor(MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = arg;
|
||||
MM_MONITOR *handle = (MM_MONITOR *) mon->handle;
|
||||
|
||||
handle->shutdown = 1;
|
||||
@ -218,10 +215,9 @@ stopMonitor(void *arg)
|
||||
* @param dcb DCB to print diagnostics
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static void diagnostics(DCB *dcb, void *arg)
|
||||
static void diagnostics(DCB *dcb, const MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MM_MONITOR *handle = (MM_MONITOR *) mon->handle;
|
||||
const MM_MONITOR *handle = (const MM_MONITOR *) mon->handle;
|
||||
MONITOR_SERVERS *db;
|
||||
char *sep;
|
||||
|
||||
|
@ -69,9 +69,9 @@ MODULE_INFO info =
|
||||
};
|
||||
/*lint +e14 */
|
||||
|
||||
static void *startMonitor(void *, void*);
|
||||
static void stopMonitor(void *);
|
||||
static void diagnostics(DCB *, void *);
|
||||
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER*);
|
||||
static void stopMonitor(MONITOR *);
|
||||
static void diagnostics(DCB *, const MONITOR *);
|
||||
static MONITOR_SERVERS *getServerByNodeId(MONITOR_SERVERS *, long);
|
||||
static MONITOR_SERVERS *getSlaveOfNodeId(MONITOR_SERVERS *, long);
|
||||
static MONITOR_SERVERS *get_replication_tree(MONITOR *, int);
|
||||
@ -140,11 +140,9 @@ GetModuleObject()
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg, void* opt)
|
||||
startMonitor(MONITOR *monitor, const CONFIG_PARAMETER* params)
|
||||
{
|
||||
MONITOR* monitor = (MONITOR*) arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR*) monitor->handle;
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*) opt;
|
||||
bool have_events = false, script_error = false;
|
||||
|
||||
if (handle)
|
||||
@ -248,9 +246,8 @@ startMonitor(void *arg, void* opt)
|
||||
* @param arg Handle on thr running monior
|
||||
*/
|
||||
static void
|
||||
stopMonitor(void *arg)
|
||||
stopMonitor(MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle;
|
||||
|
||||
handle->shutdown = 1;
|
||||
@ -263,10 +260,9 @@ stopMonitor(void *arg)
|
||||
* @param dcb DCB to print diagnostics
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static void diagnostics(DCB *dcb, void *arg)
|
||||
static void diagnostics(DCB *dcb, const MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle;
|
||||
const MYSQL_MONITOR *handle = (const MYSQL_MONITOR *) mon->handle;
|
||||
MONITOR_SERVERS *db;
|
||||
char *sep;
|
||||
|
||||
|
@ -46,9 +46,9 @@ MODULE_INFO info =
|
||||
};
|
||||
/*lint +e14 */
|
||||
|
||||
static void *startMonitor(void *, void*);
|
||||
static void stopMonitor(void *);
|
||||
static void diagnostics(DCB *, void *);
|
||||
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER *params);
|
||||
static void stopMonitor(MONITOR *);
|
||||
static void diagnostics(DCB *, const MONITOR *);
|
||||
bool isNdbEvent(monitor_event_t event);
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
@ -106,11 +106,9 @@ GetModuleObject()
|
||||
* @return A handle to use when interacting with the monitor
|
||||
*/
|
||||
static void *
|
||||
startMonitor(void *arg, void* opt)
|
||||
startMonitor(MONITOR *mon, const CONFIG_PARAMETER *params)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MYSQL_MONITOR *handle = mon->handle;
|
||||
CONFIG_PARAMETER* params = (CONFIG_PARAMETER*) opt;
|
||||
bool have_events = false, script_error = false;
|
||||
|
||||
if (handle != NULL)
|
||||
@ -195,9 +193,8 @@ startMonitor(void *arg, void* opt)
|
||||
* @param arg Handle on thr running monior
|
||||
*/
|
||||
static void
|
||||
stopMonitor(void *arg)
|
||||
stopMonitor(MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = (MONITOR*) arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle;
|
||||
|
||||
handle->shutdown = 1;
|
||||
@ -211,10 +208,9 @@ stopMonitor(void *arg)
|
||||
* @param arg The monitor handle
|
||||
*/
|
||||
static void
|
||||
diagnostics(DCB *dcb, void *arg)
|
||||
diagnostics(DCB *dcb, const MONITOR *mon)
|
||||
{
|
||||
MONITOR* mon = arg;
|
||||
MYSQL_MONITOR *handle = (MYSQL_MONITOR *) mon->handle;
|
||||
const MYSQL_MONITOR *handle = (const MYSQL_MONITOR *) mon->handle;
|
||||
MONITOR_SERVERS *db;
|
||||
char *sep;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user