🦄 refactor(remove mq): remove mq in stellar
This commit is contained in:
@@ -6,7 +6,6 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "stellar/mq.h"
|
||||
#include "stellar/log.h"
|
||||
|
||||
/*******************************************
|
||||
@@ -43,23 +42,21 @@ struct module_hooks
|
||||
module_on_thread_exit_func *on_thread_exit_cb;
|
||||
};
|
||||
|
||||
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);
|
||||
struct module_manager *module_manager_new_with_toml(const char *toml_path, 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 logger *logger);
|
||||
struct module_manager *module_manager_new_with_toml(const char *toml_path, int max_thread_num, 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);
|
||||
void module_manager_register_thread(struct module_manager *mod_mgr, int thread_id);
|
||||
void module_manager_unregister_thread(struct module_manager *mod_mgr, int thread_id);
|
||||
|
||||
// return -1 on error
|
||||
int module_manager_get_thread_id(struct module_manager *mod_mgr);
|
||||
struct mq_runtime *module_manager_get_mq_runtime(struct module_manager *mod_mgr);
|
||||
|
||||
struct module *module_manager_get_module(struct module_manager *mod_mgr, const char *module_name);
|
||||
|
||||
int module_manager_get_max_thread_num(struct module_manager *mod_mgr);
|
||||
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);
|
||||
|
||||
/*******************************************
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct mq_schema;
|
||||
struct mq_schema *mq_schema_new();
|
||||
void mq_schema_free(struct mq_schema *s);
|
||||
|
||||
typedef void mq_msg_free_cb_func(void *msg, void *msg_free_arg);
|
||||
typedef void on_msg_cb_func(int topic_id, void *msg, void *on_msg_arg);
|
||||
typedef void on_msg_dispatch_cb_func(int topic_id,
|
||||
void *msg,
|
||||
on_msg_cb_func *on_msg_cb,
|
||||
void *on_msg_cb_arg,
|
||||
void *dispatch_arg);
|
||||
|
||||
//return topic_id
|
||||
int mq_schema_create_topic(struct mq_schema *s,
|
||||
const char *topic_name,
|
||||
on_msg_dispatch_cb_func *on_dispatch_cb,
|
||||
void *on_dispatch_arg,
|
||||
mq_msg_free_cb_func *msg_free_cb,
|
||||
void *msg_free_arg);
|
||||
|
||||
int mq_schema_get_topic_id(struct mq_schema *s, const char *topic_name);
|
||||
|
||||
int mq_schema_update_topic(struct mq_schema *s,
|
||||
int topic_id,
|
||||
on_msg_dispatch_cb_func *on_dispatch_cb,
|
||||
void *on_dispatch_arg,
|
||||
mq_msg_free_cb_func *msg_free_cb,
|
||||
void *msg_free_arg);
|
||||
|
||||
int mq_schema_destroy_topic(struct mq_schema *s, int topic_id);
|
||||
|
||||
//return 0 if success, otherwise return -1.
|
||||
int mq_schema_subscribe(struct mq_schema *s, int topic_id, on_msg_cb_func *on_msg_cb, void * on_msg_cb_arg);
|
||||
|
||||
|
||||
struct mq_runtime;
|
||||
struct mq_runtime *mq_runtime_new(struct mq_schema *s);
|
||||
void mq_runtime_defer(struct mq_runtime *rt);
|
||||
void mq_runtime_free(struct mq_runtime *s);
|
||||
|
||||
// return 0 if success, otherwise return -1
|
||||
int mq_runtime_publish_message(struct mq_runtime *rt, int topic_id, void *msg);// append message to pending queue
|
||||
void mq_runtime_dispatch(struct mq_runtime *rt);// dispatch all message in pending queue, dispatched message will be append to dlq
|
||||
void mq_runtime_clean(struct mq_runtime *rt); // free all message in dlq and pending queue, during this period, publish will be disabled
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user