MOD aaa-12 配置管理模块增加模块初始化钩子
SOL 配置管理模块增加模块初始化钩子 修改人:zhangliang 检视人:zhangliang
This commit is contained in:
parent
9cb97ecd17
commit
0c75e14a95
|
@ -11,6 +11,7 @@
|
|||
|
||||
|
||||
config_service_t g_config_service[] = CONFIG_SERVICE_ARRAY;
|
||||
config_init_t g_config_init[] = CONFIG_INIT_ARRAY;
|
||||
|
||||
void test_big_data(rpc_conn *conn, pointer input, int input_len, void* data) {
|
||||
char buf[input_len];
|
||||
|
@ -145,6 +146,23 @@ ret_code cm_config_get_allconfig(uint source,
|
|||
return ret;
|
||||
}
|
||||
|
||||
void cm_config_module_init()
|
||||
{
|
||||
int len = sizeof(g_config_init) / sizeof(CONFIG_INIT_ARRAY);
|
||||
config_init_t *config_svr;
|
||||
int config_idx;
|
||||
|
||||
for(config_idx = 0; config_idx < len; config_idx++)
|
||||
{
|
||||
config_svr = &(g_config_init[config_idx]);
|
||||
|
||||
rpc_log_info("MODULE %d init\n", config_svr->config_mudlue);
|
||||
if(config_svr->init_callback)
|
||||
{
|
||||
config_svr->init_callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 配置恢复 */
|
||||
void cm_config_recovery()
|
||||
|
@ -382,6 +400,9 @@ int main(int argc, char **argv)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* 模块初始化 */
|
||||
cm_config_module_init();
|
||||
|
||||
/* 配置恢复 */
|
||||
cm_config_recovery();
|
||||
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
#define JUMPPAGE_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|4)
|
||||
#define AGINGTIME_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|5)
|
||||
|
||||
#define CONFIG_INIT_ARRAY \
|
||||
{\
|
||||
{\
|
||||
IPCONFIG_V4,\
|
||||
NULL\
|
||||
}\
|
||||
}\
|
||||
|
||||
/*
|
||||
1、配置ID,全局唯一,用于寻找对应的配置业务
|
||||
|
@ -133,6 +140,10 @@
|
|||
}\
|
||||
}
|
||||
|
||||
typedef ret_code (*cm_config_init)(uint source, uint *config_type,
|
||||
pointer input, int *input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
typedef ret_code (*cm_config_chk)(uint source, uint *config_type,
|
||||
pointer input, int *input_len,
|
||||
pointer output, int *output_len);
|
||||
|
@ -148,9 +159,17 @@ typedef ret_code (*cm_config_get)(uint source,
|
|||
typedef ret_code (*cm_config_get_all)(uint source,
|
||||
pointer output, int *output_len);
|
||||
|
||||
/* 配置注册 */
|
||||
struct _config_init {
|
||||
uint config_mudlue;
|
||||
cm_config_init init_callback;
|
||||
};
|
||||
typedef struct _config_init config_init_t;
|
||||
|
||||
|
||||
/* 配置注册 */
|
||||
struct _config_service {
|
||||
uint64 config_id; /* 配置ID,全局唯一,用于寻找对应的配置业务*/
|
||||
uint32 config_id; /* 配置ID,全局唯一,用于寻找对应的配置业务*/
|
||||
uint config_src; /* 配置源检查,全局唯一,用于寻找对应的配置业务,从低位到高位,第一位表示web,后续配置扩展 */
|
||||
boolean recovery; /* 配置恢复处理函数,如果为FALSE则不进行配置恢复 */
|
||||
boolean multi_inst; /* 是否是多实例 */
|
||||
|
|
Loading…
Reference in New Issue