🦄 refactor(remove mq): remove mq in stellar
This commit is contained in:
@@ -13,11 +13,10 @@
|
||||
* module manager API *
|
||||
*******************************************/
|
||||
|
||||
struct module_manager *module_manager_new(struct module_hooks mod_hooks[], 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(struct module_hooks mod_hooks[], size_t n_mod, int max_thread_num, const char *toml_path, struct logger *logger)
|
||||
{
|
||||
struct module_manager *mod_mgr = CALLOC(struct module_manager, 1);
|
||||
mod_mgr->config.max_thread_num=max_thread_num;
|
||||
mod_mgr->config.mq_schema=mq_schema;
|
||||
mod_mgr->config.logger=logger;
|
||||
if(toml_path)mod_mgr->config.toml_path=strdup(toml_path);
|
||||
|
||||
@@ -47,22 +46,22 @@ struct module_manager *module_manager_new(struct module_hooks mod_hooks[], size_
|
||||
return mod_mgr;
|
||||
}
|
||||
|
||||
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_with_toml(const char *toml_path, int max_thread_num, struct logger *logger)
|
||||
{
|
||||
|
||||
FILE *fp=fopen(toml_path, "r");
|
||||
if(!fp)return module_manager_new(NULL, 0, max_thread_num, toml_path, mq_schema, logger);
|
||||
if(!fp)return module_manager_new(NULL, 0, max_thread_num, toml_path,logger);
|
||||
|
||||
toml_table_t *conf = toml_parse_file(fp, NULL, 0);
|
||||
fclose(fp);
|
||||
|
||||
if(conf==NULL)return module_manager_new(NULL, 0, max_thread_num, toml_path, mq_schema, logger);
|
||||
if(conf==NULL)return module_manager_new(NULL, 0, max_thread_num, toml_path, logger);
|
||||
|
||||
toml_array_t* mod_array = toml_array_in(conf, "module");
|
||||
if(mod_array==NULL)
|
||||
{
|
||||
toml_free(conf);
|
||||
return module_manager_new(NULL, 0, max_thread_num, toml_path, mq_schema, logger);
|
||||
return module_manager_new(NULL, 0, max_thread_num, toml_path, logger);
|
||||
}
|
||||
|
||||
int mod_num = toml_array_nelem(mod_array);
|
||||
@@ -128,7 +127,7 @@ struct module_manager *module_manager_new_with_toml(const char *toml_path, int m
|
||||
}
|
||||
|
||||
toml_free(conf);
|
||||
return module_manager_new(mod_hooks, mod_num, max_thread_num, toml_path, mq_schema, logger);
|
||||
return module_manager_new(mod_hooks, mod_num, max_thread_num, toml_path, logger);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,11 +163,6 @@ int module_manager_get_max_thread_num(struct module_manager*mod_mgr)
|
||||
return mod_mgr->config.max_thread_num;
|
||||
}
|
||||
|
||||
struct mq_schema *module_manager_get_mq_schema(struct module_manager *mod_mgr)
|
||||
{
|
||||
if(mod_mgr==NULL)return NULL;
|
||||
return mod_mgr->config.mq_schema;
|
||||
}
|
||||
|
||||
struct logger *module_manager_get_logger(struct module_manager *mod_mgr)
|
||||
{
|
||||
@@ -195,11 +189,9 @@ struct mq_runtime *module_manager_get_mq_runtime(struct module_manager *mod_mgr
|
||||
return local_mq_rt;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
local_thread_id=thread_id;
|
||||
local_mq_rt=mq_rt;
|
||||
|
||||
for(int i=0; i<mod_mgr->n_descriptor; i++)
|
||||
{
|
||||
if(mod_mgr->descriptors[i].mod == NULL)break;
|
||||
|
||||
Reference in New Issue
Block a user