From cdc3ce7248bd8c8a30e2dbae1113b484c3ca05cf Mon Sep 17 00:00:00 2001 From: slguan Date: Wed, 19 Feb 2020 11:40:05 +0800 Subject: [PATCH] rename modules to plugins --- src/CMakeLists.txt | 2 +- src/dnode/inc/dnodeMgmt.h | 6 --- src/dnode/inc/dnodeSystem.h | 2 + src/dnode/src/dnodeMgmt.c | 6 +-- src/inc/http.h | 22 ---------- src/inc/mnode.h | 10 +++++ src/inc/monitor.h | 23 ++++++++++ src/mnode/src/mgmtSystem.c | 6 ++- src/modules/monitor/inc/monitor.h | 41 ------------------ src/{modules => plugins}/CMakeLists.txt | 0 src/{modules => plugins}/http/CMakeLists.txt | 0 src/{modules => plugins}/http/inc/cJSON.h | 0 src/{modules => plugins}/http/inc/gcHandle.h | 0 src/{modules => plugins}/http/inc/gcJson.h | 0 src/{modules => plugins}/http/inc/httpCode.h | 0 .../http/inc/httpHandle.h | 0 src/{modules => plugins}/http/inc/httpJson.h | 0 src/{modules => plugins}/http/inc/httpResp.h | 0 .../http/inc/httpSystem.h | 0 .../http/inc/restHandle.h | 0 src/{modules => plugins}/http/inc/restJson.h | 0 src/{modules => plugins}/http/inc/tgHandle.h | 0 src/{modules => plugins}/http/inc/tgJson.h | 0 src/{modules => plugins}/http/src/cJSON.c | 0 src/{modules => plugins}/http/src/gcHandle.c | 0 src/{modules => plugins}/http/src/gcJson.c | 0 src/{modules => plugins}/http/src/httpAuth.c | 0 src/{modules => plugins}/http/src/httpCode.c | 0 .../http/src/httpHandle.c | 0 src/{modules => plugins}/http/src/httpJson.c | 0 src/{modules => plugins}/http/src/httpResp.c | 0 .../http/src/httpServer.c | 0 .../http/src/httpSession.c | 0 src/{modules => plugins}/http/src/httpSql.c | 0 .../http/src/httpSystem.c | 0 src/{modules => plugins}/http/src/httpUtil.c | 0 .../http/src/restHandle.c | 0 src/{modules => plugins}/http/src/restJson.c | 0 src/{modules => plugins}/http/src/tgHandle.c | 0 src/{modules => plugins}/http/src/tgJson.c | 0 .../monitor/CMakeLists.txt | 0 .../monitor/inc/monitorSystem.h | 0 .../monitor/src/monitorSystem.c | 0 src/util/inc/tlog.h | 42 +++++++++++++++++++ 44 files changed, 86 insertions(+), 74 deletions(-) create mode 100644 src/inc/monitor.h delete mode 100644 src/modules/monitor/inc/monitor.h rename src/{modules => plugins}/CMakeLists.txt (100%) rename src/{modules => plugins}/http/CMakeLists.txt (100%) rename src/{modules => plugins}/http/inc/cJSON.h (100%) rename src/{modules => plugins}/http/inc/gcHandle.h (100%) rename src/{modules => plugins}/http/inc/gcJson.h (100%) rename src/{modules => plugins}/http/inc/httpCode.h (100%) rename src/{modules => plugins}/http/inc/httpHandle.h (100%) rename src/{modules => plugins}/http/inc/httpJson.h (100%) rename src/{modules => plugins}/http/inc/httpResp.h (100%) rename src/{modules => plugins}/http/inc/httpSystem.h (100%) rename src/{modules => plugins}/http/inc/restHandle.h (100%) rename src/{modules => plugins}/http/inc/restJson.h (100%) rename src/{modules => plugins}/http/inc/tgHandle.h (100%) rename src/{modules => plugins}/http/inc/tgJson.h (100%) rename src/{modules => plugins}/http/src/cJSON.c (100%) rename src/{modules => plugins}/http/src/gcHandle.c (100%) rename src/{modules => plugins}/http/src/gcJson.c (100%) rename src/{modules => plugins}/http/src/httpAuth.c (100%) rename src/{modules => plugins}/http/src/httpCode.c (100%) rename src/{modules => plugins}/http/src/httpHandle.c (100%) rename src/{modules => plugins}/http/src/httpJson.c (100%) rename src/{modules => plugins}/http/src/httpResp.c (100%) rename src/{modules => plugins}/http/src/httpServer.c (100%) rename src/{modules => plugins}/http/src/httpSession.c (100%) rename src/{modules => plugins}/http/src/httpSql.c (100%) rename src/{modules => plugins}/http/src/httpSystem.c (100%) rename src/{modules => plugins}/http/src/httpUtil.c (100%) rename src/{modules => plugins}/http/src/restHandle.c (100%) rename src/{modules => plugins}/http/src/restJson.c (100%) rename src/{modules => plugins}/http/src/tgHandle.c (100%) rename src/{modules => plugins}/http/src/tgJson.c (100%) rename src/{modules => plugins}/monitor/CMakeLists.txt (100%) rename src/{modules => plugins}/monitor/inc/monitorSystem.h (100%) rename src/{modules => plugins}/monitor/src/monitorSystem.c (100%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 712ccbffbf..d29213298a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ ADD_SUBDIRECTORY(util) ADD_SUBDIRECTORY(rpc) ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(kit) -ADD_SUBDIRECTORY(modules) +ADD_SUBDIRECTORY(plugins) ADD_SUBDIRECTORY(sdb) ADD_SUBDIRECTORY(mnode) ADD_SUBDIRECTORY(dnode) diff --git a/src/dnode/inc/dnodeMgmt.h b/src/dnode/inc/dnodeMgmt.h index 5db16258f7..4aff10026d 100644 --- a/src/dnode/inc/dnodeMgmt.h +++ b/src/dnode/inc/dnodeMgmt.h @@ -22,14 +22,8 @@ extern "C" { #include #include -#include "tsched.h" -#include "dnode.h" - void dnodeProcessMsgFromMgmt(int8_t *pCont, int32_t contLen, int32_t msgType, void *pConn); - -extern void *tsDnodeMgmtQhandle; - void dnodeSendVpeerCfgMsg(int32_t vnode); void dnodeSendMeterCfgMsg(int32_t vnode, int32_t sid); diff --git a/src/dnode/inc/dnodeSystem.h b/src/dnode/inc/dnodeSystem.h index 7e94a642e7..345375ef3c 100644 --- a/src/dnode/inc/dnodeSystem.h +++ b/src/dnode/inc/dnodeSystem.h @@ -39,6 +39,8 @@ extern void (*dnodeParseParameterK)(); extern int32_t tsMaxQueues; extern void ** tsRpcQhandle; extern void *tsQueryQhandle; +extern void *tsDnodeMgmtQhandle; + int32_t dnodeInitSystem(); void dnodeCleanUpSystem(); diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 282ff8e756..d1dcc48794 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -83,7 +83,7 @@ void dnodeProcessMsgFromMgmt(int8_t *pCont, int32_t contLen, int32_t msgType, vo dError("invalid msg type:%d", msgType); } else { if (dnodeProcessShellMsgFp[msgType]) { - (*dnodeProcessShellMsgFp[msgType])(pConn, contLen, pConn); + (*dnodeProcessShellMsgFp[msgType])(pCont, contLen, pConn); } else { dError("%s is not processed", taosMsg[msgType]); } @@ -190,7 +190,7 @@ void dnodeSendVpeerCfgMsg(int32_t vnode) { } cfg->vnode = htonl(vnode); - dnodeSendMsgToMnode(cfg, sizeof(SMeterCfgMsg)); + dnodeSendMsgToMnode(cfg, sizeof(SVpeerCfgMsg), TSDB_MSG_TYPE_VNODE_CFG); } void dnodeSendMeterCfgMsg(int32_t vnode, int32_t sid) { @@ -200,7 +200,7 @@ void dnodeSendMeterCfgMsg(int32_t vnode, int32_t sid) { } cfg->vnode = htonl(vnode); - dnodeSendMsgToMnode(cfg, sizeof(SMeterCfgMsg)); + dnodeSendMsgToMnode(cfg, sizeof(SMeterCfgMsg), TSDB_MSG_TYPE_TABLE_CFG); } void dnodeInitProcessShellMsg() { diff --git a/src/inc/http.h b/src/inc/http.h index 9ef36560e1..aaab27301a 100644 --- a/src/inc/http.h +++ b/src/inc/http.h @@ -23,28 +23,6 @@ extern "C" { #include "tglobalcfg.h" #include "tlog.h" -#define httpError(...) \ - if (httpDebugFlag & DEBUG_ERROR) { \ - tprintf("ERROR HTP ", 255, __VA_ARGS__); \ - } -#define httpWarn(...) \ - if (httpDebugFlag & DEBUG_WARN) { \ - tprintf("WARN HTP ", httpDebugFlag, __VA_ARGS__); \ - } -#define httpTrace(...) \ - if (httpDebugFlag & DEBUG_TRACE) { \ - tprintf("HTP ", httpDebugFlag, __VA_ARGS__); \ - } -#define httpDump(...) \ - if (httpDebugFlag & DEBUG_TRACE) { \ - taosPrintLongString("HTP ", httpDebugFlag, __VA_ARGS__); \ - } -#define httpPrint(...) \ - { tprintf("HTP ", 255, __VA_ARGS__); } - -#define httpLError(...) taosLogError(__VA_ARGS__) httpError(__VA_ARGS__) -#define httpLWarn(...) taosLogWarn(__VA_ARGS__) httpWarn(__VA_ARGS__) -#define httpLPrint(...) taosLogPrint(__VA_ARGS__) httpPrint(__VA_ARGS__) int32_t httpGetReqCount(); diff --git a/src/inc/mnode.h b/src/inc/mnode.h index 37d4bca28a..6b7596b575 100644 --- a/src/inc/mnode.h +++ b/src/inc/mnode.h @@ -335,8 +335,18 @@ typedef struct { char payload[]; /* payload for wildcard match in show tables */ } SShowObj; + +extern int32_t (*mgmtInitSystem)(); +extern void (*mgmtStopSystem)(); + +int32_t mgmtStartSystem(); +void mgmtCleanUpSystem(); void mgmtProcessMsgFromDnode(int8_t *pCont, int32_t contLen, int32_t msgType, void *pConn); + +extern void (*mgmtCleanUpRedirect)(); + + #ifdef __cplusplus } #endif diff --git a/src/inc/monitor.h b/src/inc/monitor.h new file mode 100644 index 0000000000..ee7ff61986 --- /dev/null +++ b/src/inc/monitor.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef __MONITOR_H__ +#define __MONITOR_H__ + +#include "tglobalcfg.h" +#include "tlog.h" + + +#endif \ No newline at end of file diff --git a/src/mnode/src/mgmtSystem.c b/src/mnode/src/mgmtSystem.c index 5148975c95..74cf029055 100644 --- a/src/mnode/src/mgmtSystem.c +++ b/src/mnode/src/mgmtSystem.c @@ -162,7 +162,10 @@ int mgmtStartSystem() { return 0; } -int32_t mgmtInitSystemImp() { return mgmtStartSystem(); } +int32_t mgmtInitSystemImp() { + return mgmtStartSystem(); +} + int32_t (*mgmtInitSystem)() = mgmtInitSystemImp; int32_t mgmtCheckMgmtRunningImp() { return 0; } @@ -177,6 +180,7 @@ void mgmtStartMgmtTimerImp() { void (*mgmtStartMgmtTimer)() = mgmtStartMgmtTimerImp; void mgmtStopSystemImp() {} + void (*mgmtStopSystem)() = mgmtStopSystemImp; void mgmtCleanUpRedirectImp() {} diff --git a/src/modules/monitor/inc/monitor.h b/src/modules/monitor/inc/monitor.h deleted file mode 100644 index 954f4898b1..0000000000 --- a/src/modules/monitor/inc/monitor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#ifndef __MONITOR_H__ -#define __MONITOR_H__ - -#include "tglobalcfg.h" -#include "tlog.h" - -#define monitorError(...) \ - if (monitorDebugFlag & DEBUG_ERROR) { \ - tprintf("ERROR MON ", 255, __VA_ARGS__); \ - } -#define monitorWarn(...) \ - if (monitorDebugFlag & DEBUG_WARN) { \ - tprintf("WARN MON ", monitorDebugFlag, __VA_ARGS__); \ - } -#define monitorTrace(...) \ - if (monitorDebugFlag & DEBUG_TRACE) { \ - tprintf("MON ", monitorDebugFlag, __VA_ARGS__); \ - } -#define monitorPrint(...) \ - { tprintf("MON ", 255, __VA_ARGS__); } - -#define monitorLError(...) taosLogError(__VA_ARGS__) monitorError(__VA_ARGS__) -#define monitorLWarn(...) taosLogWarn(__VA_ARGS__) monitorWarn(__VA_ARGS__) -#define monitorLPrint(...) taosLogPrint(__VA_ARGS__) monitorPrint(__VA_ARGS__) - -#endif \ No newline at end of file diff --git a/src/modules/CMakeLists.txt b/src/plugins/CMakeLists.txt similarity index 100% rename from src/modules/CMakeLists.txt rename to src/plugins/CMakeLists.txt diff --git a/src/modules/http/CMakeLists.txt b/src/plugins/http/CMakeLists.txt similarity index 100% rename from src/modules/http/CMakeLists.txt rename to src/plugins/http/CMakeLists.txt diff --git a/src/modules/http/inc/cJSON.h b/src/plugins/http/inc/cJSON.h similarity index 100% rename from src/modules/http/inc/cJSON.h rename to src/plugins/http/inc/cJSON.h diff --git a/src/modules/http/inc/gcHandle.h b/src/plugins/http/inc/gcHandle.h similarity index 100% rename from src/modules/http/inc/gcHandle.h rename to src/plugins/http/inc/gcHandle.h diff --git a/src/modules/http/inc/gcJson.h b/src/plugins/http/inc/gcJson.h similarity index 100% rename from src/modules/http/inc/gcJson.h rename to src/plugins/http/inc/gcJson.h diff --git a/src/modules/http/inc/httpCode.h b/src/plugins/http/inc/httpCode.h similarity index 100% rename from src/modules/http/inc/httpCode.h rename to src/plugins/http/inc/httpCode.h diff --git a/src/modules/http/inc/httpHandle.h b/src/plugins/http/inc/httpHandle.h similarity index 100% rename from src/modules/http/inc/httpHandle.h rename to src/plugins/http/inc/httpHandle.h diff --git a/src/modules/http/inc/httpJson.h b/src/plugins/http/inc/httpJson.h similarity index 100% rename from src/modules/http/inc/httpJson.h rename to src/plugins/http/inc/httpJson.h diff --git a/src/modules/http/inc/httpResp.h b/src/plugins/http/inc/httpResp.h similarity index 100% rename from src/modules/http/inc/httpResp.h rename to src/plugins/http/inc/httpResp.h diff --git a/src/modules/http/inc/httpSystem.h b/src/plugins/http/inc/httpSystem.h similarity index 100% rename from src/modules/http/inc/httpSystem.h rename to src/plugins/http/inc/httpSystem.h diff --git a/src/modules/http/inc/restHandle.h b/src/plugins/http/inc/restHandle.h similarity index 100% rename from src/modules/http/inc/restHandle.h rename to src/plugins/http/inc/restHandle.h diff --git a/src/modules/http/inc/restJson.h b/src/plugins/http/inc/restJson.h similarity index 100% rename from src/modules/http/inc/restJson.h rename to src/plugins/http/inc/restJson.h diff --git a/src/modules/http/inc/tgHandle.h b/src/plugins/http/inc/tgHandle.h similarity index 100% rename from src/modules/http/inc/tgHandle.h rename to src/plugins/http/inc/tgHandle.h diff --git a/src/modules/http/inc/tgJson.h b/src/plugins/http/inc/tgJson.h similarity index 100% rename from src/modules/http/inc/tgJson.h rename to src/plugins/http/inc/tgJson.h diff --git a/src/modules/http/src/cJSON.c b/src/plugins/http/src/cJSON.c similarity index 100% rename from src/modules/http/src/cJSON.c rename to src/plugins/http/src/cJSON.c diff --git a/src/modules/http/src/gcHandle.c b/src/plugins/http/src/gcHandle.c similarity index 100% rename from src/modules/http/src/gcHandle.c rename to src/plugins/http/src/gcHandle.c diff --git a/src/modules/http/src/gcJson.c b/src/plugins/http/src/gcJson.c similarity index 100% rename from src/modules/http/src/gcJson.c rename to src/plugins/http/src/gcJson.c diff --git a/src/modules/http/src/httpAuth.c b/src/plugins/http/src/httpAuth.c similarity index 100% rename from src/modules/http/src/httpAuth.c rename to src/plugins/http/src/httpAuth.c diff --git a/src/modules/http/src/httpCode.c b/src/plugins/http/src/httpCode.c similarity index 100% rename from src/modules/http/src/httpCode.c rename to src/plugins/http/src/httpCode.c diff --git a/src/modules/http/src/httpHandle.c b/src/plugins/http/src/httpHandle.c similarity index 100% rename from src/modules/http/src/httpHandle.c rename to src/plugins/http/src/httpHandle.c diff --git a/src/modules/http/src/httpJson.c b/src/plugins/http/src/httpJson.c similarity index 100% rename from src/modules/http/src/httpJson.c rename to src/plugins/http/src/httpJson.c diff --git a/src/modules/http/src/httpResp.c b/src/plugins/http/src/httpResp.c similarity index 100% rename from src/modules/http/src/httpResp.c rename to src/plugins/http/src/httpResp.c diff --git a/src/modules/http/src/httpServer.c b/src/plugins/http/src/httpServer.c similarity index 100% rename from src/modules/http/src/httpServer.c rename to src/plugins/http/src/httpServer.c diff --git a/src/modules/http/src/httpSession.c b/src/plugins/http/src/httpSession.c similarity index 100% rename from src/modules/http/src/httpSession.c rename to src/plugins/http/src/httpSession.c diff --git a/src/modules/http/src/httpSql.c b/src/plugins/http/src/httpSql.c similarity index 100% rename from src/modules/http/src/httpSql.c rename to src/plugins/http/src/httpSql.c diff --git a/src/modules/http/src/httpSystem.c b/src/plugins/http/src/httpSystem.c similarity index 100% rename from src/modules/http/src/httpSystem.c rename to src/plugins/http/src/httpSystem.c diff --git a/src/modules/http/src/httpUtil.c b/src/plugins/http/src/httpUtil.c similarity index 100% rename from src/modules/http/src/httpUtil.c rename to src/plugins/http/src/httpUtil.c diff --git a/src/modules/http/src/restHandle.c b/src/plugins/http/src/restHandle.c similarity index 100% rename from src/modules/http/src/restHandle.c rename to src/plugins/http/src/restHandle.c diff --git a/src/modules/http/src/restJson.c b/src/plugins/http/src/restJson.c similarity index 100% rename from src/modules/http/src/restJson.c rename to src/plugins/http/src/restJson.c diff --git a/src/modules/http/src/tgHandle.c b/src/plugins/http/src/tgHandle.c similarity index 100% rename from src/modules/http/src/tgHandle.c rename to src/plugins/http/src/tgHandle.c diff --git a/src/modules/http/src/tgJson.c b/src/plugins/http/src/tgJson.c similarity index 100% rename from src/modules/http/src/tgJson.c rename to src/plugins/http/src/tgJson.c diff --git a/src/modules/monitor/CMakeLists.txt b/src/plugins/monitor/CMakeLists.txt similarity index 100% rename from src/modules/monitor/CMakeLists.txt rename to src/plugins/monitor/CMakeLists.txt diff --git a/src/modules/monitor/inc/monitorSystem.h b/src/plugins/monitor/inc/monitorSystem.h similarity index 100% rename from src/modules/monitor/inc/monitorSystem.h rename to src/plugins/monitor/inc/monitorSystem.h diff --git a/src/modules/monitor/src/monitorSystem.c b/src/plugins/monitor/src/monitorSystem.c similarity index 100% rename from src/modules/monitor/src/monitorSystem.c rename to src/plugins/monitor/src/monitorSystem.c diff --git a/src/util/inc/tlog.h b/src/util/inc/tlog.h index 7556cc50a1..8bd4333f16 100644 --- a/src/util/inc/tlog.h +++ b/src/util/inc/tlog.h @@ -197,6 +197,48 @@ extern uint32_t cdebugFlag; #define mLWarn(...) taosLogWarn(__VA_ARGS__) mWarn(__VA_ARGS__) #define mLPrint(...) taosLogPrint(__VA_ARGS__) mPrint(__VA_ARGS__) +#define httpError(...) \ + if (httpDebugFlag & DEBUG_ERROR) { \ + tprintf("ERROR HTP ", 255, __VA_ARGS__); \ + } +#define httpWarn(...) \ + if (httpDebugFlag & DEBUG_WARN) { \ + tprintf("WARN HTP ", httpDebugFlag, __VA_ARGS__); \ + } +#define httpTrace(...) \ + if (httpDebugFlag & DEBUG_TRACE) { \ + tprintf("HTP ", httpDebugFlag, __VA_ARGS__); \ + } +#define httpDump(...) \ + if (httpDebugFlag & DEBUG_TRACE) { \ + taosPrintLongString("HTP ", httpDebugFlag, __VA_ARGS__); \ + } +#define httpPrint(...) \ + { tprintf("HTP ", 255, __VA_ARGS__); } + +#define httpLError(...) taosLogError(__VA_ARGS__) httpError(__VA_ARGS__) +#define httpLWarn(...) taosLogWarn(__VA_ARGS__) httpWarn(__VA_ARGS__) +#define httpLPrint(...) taosLogPrint(__VA_ARGS__) httpPrint(__VA_ARGS__) + +#define monitorError(...) \ + if (monitorDebugFlag & DEBUG_ERROR) { \ + tprintf("ERROR MON ", 255, __VA_ARGS__); \ + } +#define monitorWarn(...) \ + if (monitorDebugFlag & DEBUG_WARN) { \ + tprintf("WARN MON ", monitorDebugFlag, __VA_ARGS__); \ + } +#define monitorTrace(...) \ + if (monitorDebugFlag & DEBUG_TRACE) { \ + tprintf("MON ", monitorDebugFlag, __VA_ARGS__); \ + } +#define monitorPrint(...) \ + { tprintf("MON ", 255, __VA_ARGS__); } + +#define monitorLError(...) taosLogError(__VA_ARGS__) monitorError(__VA_ARGS__) +#define monitorLWarn(...) taosLogWarn(__VA_ARGS__) monitorWarn(__VA_ARGS__) +#define monitorLPrint(...) taosLogPrint(__VA_ARGS__) monitorPrint(__VA_ARGS__) + #ifdef __cplusplus } #endif -- GitLab