summaryrefslogtreecommitdiff
path: root/src/lua_plugin_manage_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua_plugin_manage_internal.h')
-rw-r--r--src/lua_plugin_manage_internal.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/lua_plugin_manage_internal.h b/src/lua_plugin_manage_internal.h
index ca55306..6fe19b0 100644
--- a/src/lua_plugin_manage_internal.h
+++ b/src/lua_plugin_manage_internal.h
@@ -249,9 +249,6 @@ void lpm_on_session_msg_func(struct session *sess, int topic_id, const void *msg
int lua_chunk_execute(lua_State *state, int ref_id, int pcount, struct lua_cdata *params, int rcount, struct lua_cdata *returns);
/* ***** ***** ***** ***** ***** ***** */
-/* 状态机相关的一些数据结构及操作, 实现在lua_plugin_manage.c中 */
-extern struct lua_plugin_manage_schema *global_schema;
-
/* TODO:统计插件的运行情况, 暂时没想好怎么用 */
/* 记录一个插件的运行状态 */
struct lua_plugin_statistics
@@ -265,6 +262,13 @@ struct lua_plugin_statistics
/* ctx_free函数调用失败的次数 */
int free_failed_count;
};
+/* 状态机相关的一些数据结构及操作, 实现在lua_plugin_manage.c中 */
+extern struct lua_plugin_manage_schema *global_schema;
+/* 保存插件的运行情况, 运行次数等信息 */
+/* 二维数组修改为一维数组, 方便使用偏移快速查找 */
+extern struct lua_plugin_statistics *global_plugin_statistics;
+/* 最大插件编号 */
+extern int global_max_plugin_id;
#define LUA_MQ_ENV_DEFAULT_KEY "__mqenv_pointer"
#define LUA_MQ_TOPIC_ID_KEY "topic_id"
@@ -290,6 +294,7 @@ struct lua_plugin
UT_array *sub_topic_array;
};
void lua_plugin_destory(void *elt);
+/* 根据ID号在整个schema中进行遍历 */
struct lua_plugin *search_plugin_by_id(int plugin_id);
#define MODEL_MARK_INIT_DONE 0x0001
@@ -336,13 +341,17 @@ struct lua_plugin_manage_schema
/* 创建的状态机数量, 状态机数量与线程的个数相同 */
int state_count;
- lua_State **thread_state;
-
- /* */
+ /* 插入模块的数量, 模块的数量与specific的数量相同 */
int model_count;
- struct lua_model *model;
-
+ /* 注册的消息队列的数量 */
int mq_count;
+ /* 所有模块中注册的插件总数量 */
+ int plugin_count;
+
+ /* 线程状态机 */
+ lua_State **thread_state;
+ /* 所有插入的模块 */
+ struct lua_model *model;
/* TODO: 创建的所有message topic id理论上应该是连续的, 可以考虑用hash数组, 寻址能更快 */
UT_array *message_mq_array;
};