Provide read-only access to loaded modules

The MXS_MODULE structure of each module is now globally exposed by the
`get_module` function. This allows the module information of any module to
be queried.

This information can then be used to validate various things but the main
goal is to provide a way for modules to declare accepted parameters in the
MXS_MODULE structure. This will be done in a later commit.

Also the function documentation is now in the header file. This should
make it easier to read.
This commit is contained in:
Markus Mäkelä
2017-01-04 07:36:47 +02:00
parent 0215ad32a1
commit 33d98830dd
2 changed files with 81 additions and 77 deletions

View File

@ -50,13 +50,74 @@ MXS_BEGIN_DECLS
#define MODULE_QUERY_CLASSIFIER "QueryClassifier" /**< A query classifier module type */
extern void *load_module(const char *module, const char *type);
extern void unload_module(const char *module);
extern void unload_all_modules();
extern void printModules();
extern void dprintAllModules(DCB *);
extern RESULTSET *moduleGetList();
extern void module_feedback_send(void*);
extern void moduleShowFeedbackReport(DCB *dcb);
/**
*@brief Load a module
*
* @param module Name of the module to load
* @param type Type of module, used purely for registration
* @return The module specific entry point structure or NULL
*/
void *load_module(const char *module, const char *type);
/**
* @brief Get a module
*
* @param name Name of the module
* @return The loaded module or NULL if the module is not loaded
*/
const MXS_MODULE *get_module(const char *name);
/**
* @brief Unload a module.
*
* No errors are returned since it is not clear that much can be done
* to fix issues relating to unloading modules.
*
* @param module The name of the module
*/
void unload_module(const char *module);
/**
* @brief Unload all modules
*
* Remove all the modules from the system, called during shutdown
* to allow termination hooks to be called.
*/
void unload_all_modules();
/**
* @brief Print Modules
*
* Diagnostic routine to display all the loaded modules
*/
void printModules();
/**
* @brief Print Modules to a DCB
*
* Diagnostic routine to display all the loaded modules
*/
void dprintAllModules(DCB *);
/**
* @brief Return a resultset that has the current set of modules in it
*
* @return A Result set
*/
RESULTSET *moduleGetList();
/**
* @brief Send loaded modules info to notification service
*
* @param data The configuration details of notification service
*/
void module_feedback_send(void*);
/**
* @brief Show feedback report
*
* Prints the feedback report to a DCB
*/
void moduleShowFeedbackReport(DCB *dcb);
MXS_END_DECLS