feat(mod_manager API): add stellar_module_manager_get_toml_path

This commit is contained in:
yangwei
2024-09-19 15:58:39 +08:00
parent 17b537b19a
commit ba13baaf34
3 changed files with 10 additions and 0 deletions

View File

@@ -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;