🦄 refactor(stellar api): split exdata and mq

This commit is contained in:
yangwei
2024-09-10 10:18:05 +08:00
parent 6403e832de
commit e9825c3988
15 changed files with 423 additions and 476 deletions

View File

@@ -7,32 +7,24 @@ extern "C"
#include <stdint.h>
struct stellar;
#include "stellar/mq.h"
#include "stellar/log.h"
#include "stellar/packet.h"
/**********************************************
* PLUGIN API *
**********************************************/
struct stellar;
//return plugin_env
typedef void *plugin_on_load_func(struct stellar *st);
typedef void plugin_on_unload_func(void *plugin_env);
/**********************************************
* PLUGIN EVENT API *
**********************************************/
struct packet;
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);
int stellar_on_raw_packet_register(struct stellar *st, plugin_on_packet_func *on_packet_cb, void *on_packet_cb_arg);
//return polling work result, 0: no work, 1: work
//return on_polling state, 0: idle, 1: working
typedef int plugin_on_polling_func(void *polling_arg);
//return polling plugin_id
int stellar_on_polling_register(struct stellar *st, plugin_on_polling_func on_polling, void *polling_arg);
/**********************************************
* STELLAR DEV API *
**********************************************/
//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);
@@ -41,7 +33,6 @@ uint16_t stellar_get_current_thread_index();
// only send user build packet, can't send packet which come from network
void stellar_send_build_packet(struct stellar *st, struct packet *pkt);
struct stellar;
struct stellar *stellar_new(const char *stellar_cfg_file, const char *plugin_cfg_file, const char *log_cfg_file);
void stellar_run(struct stellar *st);
void stellar_free(struct stellar *st);
@@ -49,6 +40,9 @@ void stellar_loopbreak(struct stellar *st);
void stellar_reload_log_level(struct stellar *st);
struct logger *stellar_get_logger(struct stellar *st);
struct mq_schema *stellar_get_mq_schema(struct stellar *st);
struct mq_runtime *stellar_get_mq_runtime(struct stellar *st);
#ifdef __cplusplus
}
#endif