2024-09-14 12:18:26 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "stellar/mq.h"
|
|
|
|
|
|
|
|
|
|
struct stellar_module;
|
2024-09-19 15:58:39 +08:00
|
|
|
struct stellar_module *stellar_module_new(const char *name, void *ctx);
|
2024-09-14 12:18:26 +08:00
|
|
|
void stellar_module_free(struct stellar_module *mod);
|
|
|
|
|
|
|
|
|
|
void * stellar_module_get_ctx(struct stellar_module *mod);
|
|
|
|
|
void stellar_module_set_ctx(struct stellar_module *mod, void *ctx);
|
|
|
|
|
|
|
|
|
|
const char *stellar_module_get_name(struct stellar_module* mod);
|
2024-09-14 16:00:24 +08:00
|
|
|
void stellar_module_set_name(struct stellar_module* mod, const char *name);
|
2024-09-14 12:18:26 +08:00
|
|
|
|
|
|
|
|
struct stellar_module_manager;
|
|
|
|
|
|
|
|
|
|
typedef struct stellar_module *module_on_init_func(struct stellar_module_manager *mod_mgr);
|
|
|
|
|
typedef void module_on_exit_func(struct stellar_module_manager *mod_mgr, struct stellar_module *mod);
|
|
|
|
|
|
|
|
|
|
struct stellar_module_manager *stellar_module_manager_new(const char *module_spec_toml_path, int max_thread_num, struct mq_schema *mq_schema);
|
|
|
|
|
void stellar_module_manager_free(struct stellar_module_manager *mod_mgr);
|
|
|
|
|
|
|
|
|
|
void stellar_module_manager_register_thread(struct stellar_module_manager* mod_mgr, int thread_id, struct mq_runtime *mq_rt);
|
|
|
|
|
|
|
|
|
|
// return -1 on error
|
|
|
|
|
int stellar_module_manager_get_thread_id(struct stellar_module_manager* mod_mgr);
|
2024-09-19 16:56:26 +08:00
|
|
|
struct mq_runtime *stellar_module_manager_get_mq_runtime(struct stellar_module_manager *mod_mgr);
|
2024-09-14 12:18:26 +08:00
|
|
|
|
2024-09-19 16:56:26 +08:00
|
|
|
struct stellar_module *stellar_module_manager_get_module(struct stellar_module_manager *mod_mgr, const char *module_name);
|
|
|
|
|
|
|
|
|
|
int stellar_module_manager_get_max_thread_num(struct stellar_module_manager* mod_mgr);
|
2024-09-19 15:58:39 +08:00
|
|
|
const char *stellar_module_manager_get_toml_path(struct stellar_module_manager *mod_mgr);
|
2024-09-19 16:56:26 +08:00
|
|
|
struct mq_schema *stellar_module_manager_get_mq_schema(struct stellar_module_manager *mod_mgr);
|
|
|
|
|
|
2024-09-25 17:44:27 +08:00
|
|
|
typedef void module_on_polling_func(struct stellar_module_manager* mod_mgr, void *polling_arg);
|
|
|
|
|
//return 0 if success, otherwise return -1.
|
|
|
|
|
int stellar_module_manager_polling_subscribe(struct stellar_module_manager* mod_mgr, module_on_polling_func on_polling, void *polling_arg);
|
|
|
|
|
void stellar_module_manager_polling_dispatch(struct stellar_module_manager *mod_mgr);
|
|
|
|
|
void stellar_module_manager_polling_active(struct stellar_module_manager *mod_mgr);
|
2024-09-14 12:18:26 +08:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|