summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-11-25 19:23:01 +0800
committeryangwei <[email protected]>2024-11-25 19:23:01 +0800
commitef5a65155b11fec8c6234f0a18678e11d7f79cf1 (patch)
treee1f76e17711b5498e85cb3564e7e4251c81fbb1b /include
parente2776414401af0bc02beb305b0d366fe3828cffd (diff)
🦄 refactor(module_manager ): new with hooks
Diffstat (limited to 'include')
-rw-r--r--include/stellar/module.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/stellar/module.h b/include/stellar/module.h
index b0dc738..0f43a4c 100644
--- a/include/stellar/module.h
+++ b/include/stellar/module.h
@@ -24,7 +24,7 @@ const char *module_get_name(struct module* mod);
void module_set_name(struct module* mod, const char *name);
/*******************************************
- * module API *
+ * module manager API *
*******************************************/
struct module_manager;
@@ -35,7 +35,7 @@ typedef void module_on_instance_exit_func(struct module_manager *mod_mgr, struct
typedef struct module *module_on_thread_init_func(struct module_manager *mod_mgr, int thread_id, struct module *mod);
typedef void module_on_thread_exit_func(struct module_manager *mod_mgr, int thread_id, struct module *mod);
-struct module_specification
+struct module_hooks
{
module_on_instance_init_func *on_instance_init_cb;
module_on_instance_exit_func *on_instance_exit_cb;
@@ -43,7 +43,7 @@ struct module_specification
module_on_thread_exit_func *on_thread_exit_cb;
};
-struct module_manager *module_manager_new(struct module_specification mod_specs[], size_t n_mod, int max_thread_num, struct mq_schema *mq_schema, struct logger *logger);
+struct module_manager *module_manager_new(struct module_hooks mod_specs[], size_t n_mod, int max_thread_num, const char *toml_path, struct mq_schema *mq_schema, struct logger *logger);
void module_manager_free(struct module_manager *mod_mgr);
void module_manager_register_thread(struct module_manager *mod_mgr, int thread_id, struct mq_runtime *mq_rt);
@@ -60,6 +60,10 @@ const char *module_manager_get_toml_path(struct module_manager *mod_mgr);
struct mq_schema *module_manager_get_mq_schema(struct module_manager *mod_mgr);
struct logger *module_manager_get_logger(struct module_manager *mod_mgr);
+/*******************************************
+ * polling API *
+ *******************************************/
+
typedef void module_on_polling_func(struct module_manager *mod_mgr, void *polling_arg);
int module_manager_polling_subscribe(struct module_manager *mod_mgr, module_on_polling_func on_polling, void *polling_arg);
void module_manager_polling_active(struct module_manager *mod_mgr);