MXS-1848 Introduce a specific monitor type

Instead of using void there's now a MXS_SPECIFIC_MONITOR struct
from which monitor specific types can be derived. This change
does not bring about other benefits than a bit of clarity but
this is the first step in clearing up the monitor API.
This commit is contained in:
Johan Wikman
2018-05-04 10:02:06 +03:00
parent 1f6cc6db8a
commit d4008f7b28
11 changed files with 34 additions and 30 deletions

View File

@ -31,6 +31,14 @@ MXS_BEGIN_DECLS
struct mxs_monitor;
typedef struct mxs_monitor MXS_MONITOR;
/**
* An opaque type from which types specific for a particular
* monitor can be derived.
*/
typedef struct mxs_specific_monitor
{
} MXS_SPECIFIC_MONITOR;
/**
* @verbatim
* The "module object" structure for a backend monitor module
@ -68,7 +76,8 @@ typedef struct mxs_monitor_object
*
* @return Pointer to the monitor specific data, stored in @c monitor->handle
*/
void *(*startMonitor)(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER *params);
MXS_SPECIFIC_MONITOR *(*startMonitor)(MXS_MONITOR *monitor,
const MXS_CONFIG_PARAMETER *params);
/**
* @brief Stop the monitor
@ -95,7 +104,7 @@ typedef struct mxs_monitor_object
* The monitor API version number. Any change to the monitor module API
* must change these versions using the rules defined in modinfo.h
*/
#define MXS_MONITOR_VERSION {3, 1, 0}
#define MXS_MONITOR_VERSION {4, 0, 0}
/**
* Specifies capabilities specific for monitor.
@ -211,7 +220,7 @@ struct mxs_monitor
*/
MXS_MONITOR_OBJECT *module; /**< The "monitor object" */
char *module_name; /**< Name of the monitor module */
void *handle; /**< Handle returned from startMonitor */
MXS_SPECIFIC_MONITOR *handle; /**< Handle returned from startMonitor */
size_t interval; /**< The monitor interval */
volatile bool server_pending_changes;
/**< Are there any pending changes to a server?