MXS-1220: Add /maxscale/tasks resource
The resource shows all active tasks inside MaxScale.
This commit is contained in:
@ -68,9 +68,61 @@ extern void hkshutdown();
|
||||
*/
|
||||
extern void hkfinish();
|
||||
|
||||
extern int hktask_add(const char *name, void (*task)(void *), void *data, int frequency);
|
||||
extern int hktask_oneshot(const char *name, void (*task)(void *), void *data, int when);
|
||||
extern int hktask_remove(const char *name);
|
||||
extern void hkshow_tasks(DCB *pdcb);
|
||||
/**
|
||||
* @brief Add a new task
|
||||
*
|
||||
* The task will be first run @c frequency seconds after this call is
|
||||
* made and will the be executed repeatedly every frequency seconds
|
||||
* until the task is removed.
|
||||
*
|
||||
* Task names must be unique.
|
||||
*
|
||||
* @param name Task name
|
||||
* @param task Function to execute
|
||||
* @param data Data passed to function as the parameter
|
||||
* @param frequency Frequency of execution
|
||||
*
|
||||
* @return 1 if task was added
|
||||
*/
|
||||
int hktask_add(const char *name, void (*task)(void *) , void *data, int frequency);
|
||||
|
||||
/**
|
||||
* @brief Add oneshot task
|
||||
*
|
||||
* The task will only execute once.
|
||||
*
|
||||
* @param name Task name
|
||||
* @param task Function to execute
|
||||
* @param data Data passed to function as the parameter
|
||||
* @param when Number of seconds to wait until task is executed
|
||||
*
|
||||
* @return 1 if task was added
|
||||
*/
|
||||
int hktask_oneshot(const char *name, void (*task)(void *) , void *data, int when);
|
||||
|
||||
/**
|
||||
* @brief Remove a task
|
||||
*
|
||||
* @param name Task name
|
||||
*
|
||||
* @return 1 if the task was removed
|
||||
*/
|
||||
int hktask_remove(const char *name);
|
||||
|
||||
/**
|
||||
* @brief Show the tasks that are scheduled for the house keeper
|
||||
*
|
||||
* @param pdcb The DCB to send to output
|
||||
*/
|
||||
void hkshow_tasks(DCB *pdcb);
|
||||
|
||||
/**
|
||||
* @brief Show tasks as JSON resource
|
||||
*
|
||||
* @param host Hostname of this server
|
||||
*
|
||||
* @return Collection of JSON formatted task resources
|
||||
*/
|
||||
json_t* hk_tasks_json(const char* host);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
Reference in New Issue
Block a user