Move module object inside MODULE_INFO
This allows modules to only expose one entry point with a consistent signature. In the future, this could be used to implement declarations of module parameters.
This commit is contained in:
@ -22,17 +22,6 @@
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/debug.h>
|
||||
|
||||
/*lint -e14 */
|
||||
MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_BETA_RELEASE,
|
||||
MONITOR_VERSION,
|
||||
"Aurora monitor",
|
||||
"V1.0.0"
|
||||
};
|
||||
/*lint +e14 */
|
||||
|
||||
typedef struct aurora_monitor
|
||||
{
|
||||
bool shutdown; /**< True if the monitor is stopped */
|
||||
@ -348,13 +337,6 @@ diagnostics(DCB *dcb, const MONITOR *mon)
|
||||
{
|
||||
}
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
/**
|
||||
* The module entry point routine. It is this routine that must populate the
|
||||
* structure that is referred to as the "module object", this is a structure
|
||||
@ -362,9 +344,24 @@ static MONITOR_OBJECT MyObject =
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MONITOR_OBJECT *
|
||||
GetModuleObject()
|
||||
MODULE_INFO* GetModuleObject()
|
||||
{
|
||||
return &MyObject;
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
static MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_BETA_RELEASE,
|
||||
MONITOR_VERSION,
|
||||
"Aurora monitor",
|
||||
"V1.0.0",
|
||||
&MyObject
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
@ -43,20 +43,6 @@ static void monitorMain(void *);
|
||||
/** Log a warning when a bad 'wsrep_local_index' is found */
|
||||
static bool warn_erange_on_local_index = true;
|
||||
|
||||
/* @see function load_module in load_utils.c for explanation of the following
|
||||
* lint directives.
|
||||
*/
|
||||
/*lint -e14 */
|
||||
MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_GA,
|
||||
MONITOR_VERSION,
|
||||
"A Galera cluster monitor",
|
||||
"V2.0.0"
|
||||
};
|
||||
/*lint +e14 */
|
||||
|
||||
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER *params);
|
||||
static void stopMonitor(MONITOR *);
|
||||
static void diagnostics(DCB *, const MONITOR *);
|
||||
@ -65,26 +51,6 @@ static MONITOR_SERVERS *set_cluster_master(MONITOR_SERVERS *, MONITOR_SERVERS *,
|
||||
static void disableMasterFailback(void *, int);
|
||||
bool isGaleraEvent(monitor_event_t event);
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
/**
|
||||
* The module initialisation routine, called when the module
|
||||
* is first loaded.
|
||||
* @see function load_module in load_utils.c for explanation of lint
|
||||
*/
|
||||
/*lint -e14 */
|
||||
void
|
||||
ModuleInit()
|
||||
{
|
||||
MXS_NOTICE("Initialise the MySQL Galera Monitor module.");
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
||||
/**
|
||||
* The module entry point routine. It is this routine that
|
||||
* must populate the structure that is referred to as the
|
||||
@ -93,12 +59,29 @@ ModuleInit()
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MONITOR_OBJECT *
|
||||
GetModuleObject()
|
||||
MODULE_INFO* GetModuleObject()
|
||||
{
|
||||
return &MyObject;
|
||||
MXS_NOTICE("Initialise the MySQL Galera Monitor module.");
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
static MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_GA,
|
||||
MONITOR_VERSION,
|
||||
"A Galera cluster monitor",
|
||||
"V2.0.0",
|
||||
&MyObject
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
||||
/**
|
||||
* Start the instance of the monitor, returning a handle on the monitor.
|
||||
|
@ -52,13 +52,6 @@ static void detectStaleMaster(void *, int);
|
||||
static MONITOR_SERVERS *get_current_master(MONITOR *);
|
||||
static bool isMySQLEvent(monitor_event_t event);
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
/**
|
||||
* The module entry point routine. It is this routine that
|
||||
* must populate the structure that is referred to as the
|
||||
@ -67,11 +60,28 @@ static MONITOR_OBJECT MyObject =
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MONITOR_OBJECT *
|
||||
GetModuleObject()
|
||||
MODULE_INFO* GetModuleObject()
|
||||
{
|
||||
MXS_NOTICE("Initialise the Multi-Master Monitor module.");
|
||||
return &MyObject;
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
static MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_BETA_RELEASE,
|
||||
MONITOR_VERSION,
|
||||
"A Multi-Master Multi Master monitor",
|
||||
"V1.1.1",
|
||||
&MyObject
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
||||
|
@ -72,20 +72,6 @@
|
||||
|
||||
static void monitorMain(void *);
|
||||
|
||||
/* @see function load_module in load_utils.c for explanation of the following
|
||||
* lint directives.
|
||||
*/
|
||||
/*lint -e14 */
|
||||
MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_GA,
|
||||
MONITOR_VERSION,
|
||||
"A MySQL Master/Slave replication monitor",
|
||||
"V1.5.0"
|
||||
};
|
||||
/*lint +e14 */
|
||||
|
||||
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER*);
|
||||
static void stopMonitor(MONITOR *);
|
||||
static void diagnostics(DCB *, const MONITOR *);
|
||||
@ -100,13 +86,6 @@ void check_maxscale_schema_replication(MONITOR *monitor);
|
||||
static bool report_version_err = true;
|
||||
static const char* hb_table_name = "maxscale_schema.replication_heartbeat";
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
/**
|
||||
* The module entry point routine. It is this routine that
|
||||
* must populate the structure that is referred to as the
|
||||
@ -115,11 +94,28 @@ static MONITOR_OBJECT MyObject =
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MONITOR_OBJECT *
|
||||
GetModuleObject()
|
||||
MODULE_INFO* GetModuleObject()
|
||||
{
|
||||
MXS_NOTICE("Initialise the MySQL Monitor module.");
|
||||
return &MyObject;
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
static MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_GA,
|
||||
MONITOR_VERSION,
|
||||
"A MySQL Master/Slave replication monitor",
|
||||
"V1.5.0",
|
||||
&MyObject
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,14 +35,7 @@ static void monitorMain(void *);
|
||||
* lint directives.
|
||||
*/
|
||||
/*lint -e14 */
|
||||
MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_BETA_RELEASE,
|
||||
MONITOR_VERSION,
|
||||
"A MySQL cluster SQL node monitor",
|
||||
"V2.1.0"
|
||||
};
|
||||
|
||||
/*lint +e14 */
|
||||
|
||||
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER *params);
|
||||
@ -50,12 +43,7 @@ static void stopMonitor(MONITOR *);
|
||||
static void diagnostics(DCB *, const MONITOR *);
|
||||
bool isNdbEvent(monitor_event_t event);
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The module entry point routine. It is this routine that
|
||||
@ -65,11 +53,28 @@ static MONITOR_OBJECT MyObject =
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MONITOR_OBJECT *
|
||||
GetModuleObject()
|
||||
MODULE_INFO* GetModuleObject()
|
||||
{
|
||||
MXS_NOTICE("Initialise the MySQL Cluster Monitor module.");
|
||||
return &MyObject;
|
||||
|
||||
static MONITOR_OBJECT MyObject =
|
||||
{
|
||||
startMonitor,
|
||||
stopMonitor,
|
||||
diagnostics
|
||||
};
|
||||
|
||||
static MODULE_INFO info =
|
||||
{
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_BETA_RELEASE,
|
||||
MONITOR_VERSION,
|
||||
"A MySQL cluster SQL node monitor",
|
||||
"V2.1.0",
|
||||
&MyObject
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
||||
|
Reference in New Issue
Block a user