🦄 refactor(module_manager ): new with hooks

This commit is contained in:
yangwei
2024-11-25 19:23:01 +08:00
parent e277641440
commit ef5a65155b
6 changed files with 141 additions and 126 deletions

View File

@@ -16,33 +16,35 @@ extern "C"
struct module
{
char name[NAME_MAX];
void *module_ctx;
void *ctx;
};
struct module_spec_load
struct module_descriptor
{
struct module_hooks hooks;
struct module *mod;
struct module_specification spec;
bool init_succ;
bool initialized;
}__attribute__((aligned(sizeof(void*))));
struct module_manager
{
char *module_spec_toml_path;
struct module_spec_load *module_specs;
int load_module_num;
struct module_descriptor *descriptors;
int n_descriptor;
int topic_polling_id;
struct
{
char *toml_path;
int max_thread_num;
struct mq_schema *mq_schema;
struct logger *logger;
}schema;
}config;
}__attribute__((aligned(sizeof(void*))));
void stellar_polling_dispatch(struct module_manager *mod_mgr);
struct module_manager *module_manager_new_with_toml(const char *toml_path, int max_thread_num, struct mq_schema *mq_schema, struct logger *logger);
void module_manager_polling_dispatch(struct module_manager *mod_mgr);
#ifdef __cplusplus
}