MXS-1848 Add initMonitor() and finishMonitor() functions.

Not called and implementations are dummies.
This commit is contained in:
Johan Wikman
2018-05-04 13:49:18 +03:00
parent ec8b9c773a
commit 02cd7b9275
7 changed files with 126 additions and 1 deletions

View File

@ -64,6 +64,38 @@ typedef struct mxs_specific_monitor
*/
typedef struct mxs_monitor_object
{
/**
* @brief Initialize the monitor.
*
* This entry point is called once when MaxScale is started, for
* initializing the monitor.
*
* If the function fails, MaxScale will not start. That is, it
* should fail only for fatal reasons such as not being able to
* create vital resources. The function may contact servers and
* log errors if that does not succeed, but a failure to contact
* some server must not be treated as a fatal error.
*
* @param monitor The monitor object.
* @param params Parameters for this monitor
*
* @return Pointer to the monitor specific data. Will be stored
* in @c monitor->handle.
*/
MXS_SPECIFIC_MONITOR *(*initMonitor)(MXS_MONITOR *monitor,
const MXS_CONFIG_PARAMETER *params);
/**
* @brief Finish the monitor.
*
* This entry point is called once when MaxScale is shutting down, iff
* the earlier call to @c initMonitor returned on object. The monitor should
* perform all needed cleanup.
*
* @param monitor The monitor object.
*/
void (*finishMonitor)(MXS_SPECIFIC_MONITOR *monitor);
/**
* @brief Start the monitor
*
@ -74,7 +106,8 @@ typedef struct mxs_monitor_object
* @param monitor The monitor object
* @param params Parameters for this monitor
*
* @return Pointer to the monitor specific data, stored in @c monitor->handle
* @return Pointer to the monitor specific data. Will be stored
* in @c monitor->handle.
*/
MXS_SPECIFIC_MONITOR *(*startMonitor)(MXS_MONITOR *monitor,
const MXS_CONFIG_PARAMETER *params);

View File

@ -177,6 +177,18 @@ static void auroramon_free(AURORA_MONITOR *handle)
}
}
static
MXS_SPECIFIC_MONITOR* initMonitor(MXS_MONITOR* mon, const MXS_CONFIG_PARAMETER* params)
{
ss_dassert(!true);
return NULL;
}
static void finishMonitor(MXS_SPECIFIC_MONITOR* mon)
{
ss_dassert(!true);
}
/**
* @brief Start the monitor
*
@ -278,6 +290,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
{
static MXS_MONITOR_OBJECT MyObject =
{
initMonitor,
finishMonitor,
startMonitor,
stopMonitor,
diagnostics,

View File

@ -30,6 +30,9 @@ static void monitorMain(void *);
/** Log a warning when a bad 'wsrep_local_index' is found */
static bool warn_erange_on_local_index = true;
static MXS_SPECIFIC_MONITOR *initMonitor(MXS_MONITOR *mon,
const MXS_CONFIG_PARAMETER *params);
static void finishMonitor(MXS_SPECIFIC_MONITOR* monitor);
static MXS_SPECIFIC_MONITOR *startMonitor(MXS_MONITOR *,
const MXS_CONFIG_PARAMETER *params);
static void stopMonitor(MXS_SPECIFIC_MONITOR *);
@ -65,6 +68,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
static MXS_MONITOR_OBJECT MyObject =
{
initMonitor,
finishMonitor,
startMonitor,
stopMonitor,
diagnostics,
@ -113,6 +118,18 @@ MXS_MODULE* MXS_CREATE_MODULE()
}
static MXS_SPECIFIC_MONITOR *initMonitor(MXS_MONITOR *mon,
const MXS_CONFIG_PARAMETER *params)
{
ss_dassert(!true);
return NULL;
}
static void finishMonitor(MXS_SPECIFIC_MONITOR* monitor)
{
ss_dassert(!true);
}
/**
* Start the instance of the monitor, returning a handle on the monitor.
*

View File

@ -118,6 +118,18 @@ stopMonitor(MXS_SPECIFIC_MONITOR *mon)
delete handle;
}
static MXS_SPECIFIC_MONITOR* initMonitor(MXS_MONITOR *mon,
const MXS_CONFIG_PARAMETER *params)
{
ss_dassert(!true);
return NULL;
}
static void finishMonitor(MXS_SPECIFIC_MONITOR* mon)
{
ss_dassert(!true);
}
/**
* Diagnostic interface
*
@ -321,6 +333,8 @@ extern "C"
{
static MXS_MONITOR_OBJECT MyObject =
{
initMonitor,
finishMonitor,
startMonitor,
stopMonitor,
diagnostics,

View File

@ -904,6 +904,18 @@ bool MariaDBMonitor::check_sql_files()
return rval;
}
static MXS_SPECIFIC_MONITOR* initMonitor(MXS_MONITOR *monitor,
const MXS_CONFIG_PARAMETER* params)
{
ss_dassert(!true);
return NULL;
}
static void finishMonitor(MXS_SPECIFIC_MONITOR* monitor)
{
ss_dassert(!true);
}
/**
* Start the monitor instance and return the instance data. This function creates a thread to
* execute the monitoring. Use stopMonitor() to stop the thread.
@ -1121,6 +1133,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
static MXS_MONITOR_OBJECT MyObject =
{
initMonitor,
finishMonitor,
startMonitor,
stopMonitor,
diagnostics,

View File

@ -38,6 +38,8 @@ MXS_MODULE info =
};
/*lint +e14 */
static MXS_SPECIFIC_MONITOR *initMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER *);
static void finishMonitor(MXS_SPECIFIC_MONITOR *);
static MXS_SPECIFIC_MONITOR *startMonitor(MXS_MONITOR *, const MXS_CONFIG_PARAMETER *);
static void stopMonitor(MXS_SPECIFIC_MONITOR *);
static void diagnostics(const MXS_SPECIFIC_MONITOR *, DCB *);
@ -62,6 +64,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
static MXS_MONITOR_OBJECT MyObject =
{
initMonitor,
finishMonitor,
startMonitor,
stopMonitor,
diagnostics,
@ -106,6 +110,18 @@ MXS_MODULE* MXS_CREATE_MODULE()
}
/*lint +e14 */
static MXS_SPECIFIC_MONITOR* initMonitor(MXS_MONITOR *mon,
const MXS_CONFIG_PARAMETER *params)
{
ss_dassert(!true);
return NULL;
}
static void finishMonitor(MXS_SPECIFIC_MONITOR* mon)
{
ss_dassert(!true);
}
/**
* Start the instance of the monitor, returning a handle on the monitor.
*

View File

@ -30,6 +30,9 @@ static void monitorMain(void *);
/*lint +e14 */
static MXS_SPECIFIC_MONITOR *initMonitor(MXS_MONITOR *,
const MXS_CONFIG_PARAMETER *params);
static void finishMonitor(MXS_SPECIFIC_MONITOR*);
static MXS_SPECIFIC_MONITOR *startMonitor(MXS_MONITOR *,
const MXS_CONFIG_PARAMETER *params);
static void stopMonitor(MXS_SPECIFIC_MONITOR *);
@ -56,6 +59,8 @@ MXS_MODULE* MXS_CREATE_MODULE()
static MXS_MONITOR_OBJECT MyObject =
{
initMonitor,
finishMonitor,
startMonitor,
stopMonitor,
diagnostics,
@ -99,6 +104,18 @@ MXS_MODULE* MXS_CREATE_MODULE()
}
/*lint +e14 */
static MXS_SPECIFIC_MONITOR* initMonitor(MXS_MONITOR *mon,
const MXS_CONFIG_PARAMETER *params)
{
ss_dassert(!true);
return NULL;
}
void finishMonitor(MXS_SPECIFIC_MONITOR* mon)
{
ss_dassert(!true);
}
/**
* Start the instance of the monitor, returning a handle on the monitor.
*