feat(deps/utable): define kv in utable.h temporary

This commit is contained in:
yangwei
2024-11-25 19:22:41 +08:00
parent 4008363820
commit e277641440
9 changed files with 419 additions and 295 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <stdlib.h>
#ifdef __cplusplus
extern "C"
{
@@ -8,6 +9,10 @@ extern "C"
#include "stellar/mq.h"
#include "stellar/log.h"
/*******************************************
* module API *
*******************************************/
struct module;
struct module *module_new(const char *name, void *ctx);
void module_free(struct module *mod);
@@ -18,6 +23,10 @@ void module_set_ctx(struct module *mod, void *ctx);
const char *module_get_name(struct module* mod);
void module_set_name(struct module* mod, const char *name);
/*******************************************
* module API *
*******************************************/
struct module_manager;
typedef struct module *module_on_instance_init_func(struct module_manager *mod_mgr);
@@ -26,7 +35,15 @@ typedef void module_on_instance_exit_func(struct module_manager *mod_mgr, struct
typedef struct module *module_on_thread_init_func(struct module_manager *mod_mgr, int thread_id, struct module *mod);
typedef void module_on_thread_exit_func(struct module_manager *mod_mgr, int thread_id, struct module *mod);
struct module_manager *module_manager_new(const char *module_spec_toml_path, int max_thread_num, struct mq_schema *mq_schema, struct logger *logger);
struct module_specification
{
module_on_instance_init_func *on_instance_init_cb;
module_on_instance_exit_func *on_instance_exit_cb;
module_on_thread_init_func *on_thread_init_cb;
module_on_thread_exit_func *on_thread_exit_cb;
};
struct module_manager *module_manager_new(struct module_specification mod_specs[], size_t n_mod, int max_thread_num, struct mq_schema *mq_schema, 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);