From ba13baaf344ac69bd0517d73db3cb7cdd5de4195 Mon Sep 17 00:00:00 2001 From: yangwei Date: Thu, 19 Sep 2024 15:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(mod=5Fmanager=20API):=20add=20?= =?UTF-8?q?stellar=5Fmodule=5Fmanager=5Fget=5Ftoml=5Fpath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/stellar/module_manager.h | 1 + infra/module_manager/module_manager.c | 8 ++++++++ infra/module_manager/module_manager_interna.h | 1 + 3 files changed, 10 insertions(+) diff --git a/include/stellar/module_manager.h b/include/stellar/module_manager.h index e4983bb..fad50cf 100644 --- a/include/stellar/module_manager.h +++ b/include/stellar/module_manager.h @@ -33,6 +33,7 @@ struct stellar_module *stellar_module_manager_get_module(struct stellar_module_m int stellar_module_manager_get_thread_id(struct stellar_module_manager* mod_mgr); int stellar_module_manager_get_max_thread_num(struct stellar_module_manager* mod_mgr); +const char *stellar_module_manager_get_toml_path(struct stellar_module_manager *mod_mgr); struct mq_schema *stellar_module_get_mq_schema(struct stellar_module_manager *mod_mgr); struct mq_runtime *stellar_module_get_mq_runtime(struct stellar_module_manager *mod_mgr); diff --git a/infra/module_manager/module_manager.c b/infra/module_manager/module_manager.c index 3e56c35..38ffb9b 100644 --- a/infra/module_manager/module_manager.c +++ b/infra/module_manager/module_manager.c @@ -110,6 +110,7 @@ struct stellar_module_manager *stellar_module_manager_new(const char *module_spe toml_table_t *conf = toml_parse_file_path(module_spec_toml_path); struct stellar_module_manager *mod_mgr=stellar_module_manager_new_with_toml(conf, max_thread_num, mq_schema); if(conf)toml_free(conf); + if(module_spec_toml_path)mod_mgr->module_spec_toml_path=strdup(module_spec_toml_path); return mod_mgr; } @@ -117,6 +118,7 @@ void stellar_module_manager_free(struct stellar_module_manager *mod_mgr) { if(mod_mgr==NULL)return; struct module_specific *p=NULL; + if(mod_mgr->module_spec_toml_path)FREE(mod_mgr->module_spec_toml_path); if (mod_mgr->schema.module_specs_array) { while ((p = (struct module_specific *)utarray_next(mod_mgr->schema.module_specs_array, p))) @@ -142,6 +144,12 @@ struct mq_schema *stellar_module_get_mq_schema(struct stellar_module_manager *mo return mod_mgr->schema.mq_schema; } +const char *stellar_module_manager_get_toml_path(struct stellar_module_manager *mod_mgr) +{ + if(mod_mgr==NULL)return NULL; + return mod_mgr->module_spec_toml_path; +} + __thread int local_thread_id=-1; __thread struct mq_runtime *local_mq_rt=NULL; diff --git a/infra/module_manager/module_manager_interna.h b/infra/module_manager/module_manager_interna.h index 6ab1558..16ed7e0 100644 --- a/infra/module_manager/module_manager_interna.h +++ b/infra/module_manager/module_manager_interna.h @@ -20,6 +20,7 @@ struct stellar_module struct stellar_module_manager { + char *module_spec_toml_path; struct { UT_array *module_specs_array;