feat(module manager): Define and implement the polling API

This commit is contained in:
yangwei
2024-09-25 17:44:27 +08:00
parent c550acef84
commit 7291db5969
6 changed files with 102 additions and 7 deletions

View File

@@ -37,6 +37,11 @@ int stellar_module_manager_get_max_thread_num(struct stellar_module_manager* mod
const char *stellar_module_manager_get_toml_path(struct stellar_module_manager *mod_mgr);
struct mq_schema *stellar_module_manager_get_mq_schema(struct stellar_module_manager *mod_mgr);
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);
#ifdef __cplusplus
}

View File

@@ -18,11 +18,6 @@ typedef void plugin_on_packet_func(struct packet *pkt, void *on_packet_cb_arg);
//return 0 if success, otherwise return -1.
int stellar_raw_packet_subscribe(struct stellar *st, plugin_on_packet_func *on_packet_cb, void *on_packet_cb_arg);
//return on_polling state, 0: idle, 1: working
typedef int plugin_on_polling_func(void *polling_arg);
//return 0 if success, otherwise return -1.
int stellar_polling_subscribe(struct stellar *st, plugin_on_polling_func on_polling, void *polling_arg);
void stellar_emit_datapath_telemetry(struct packet *pkt, const char * module, const char *str);
// only send user build packet, can't send packet which come from network