提交 07327866 编写于 作者: S slguan

[TD-52] refactor interface

上级 c2067ab4
...@@ -6,7 +6,7 @@ IF (TD_SYNC) ...@@ -6,7 +6,7 @@ IF (TD_SYNC)
ENDIF () ENDIF ()
IF (TD_ACCOUNT) IF (TD_ACCOUNT)
ADD_DEFINITIONS(-D_ACCOUNT) ADD_DEFINITIONS(-D_ACCT)
ENDIF () ENDIF ()
IF (TD_ADMIN) IF (TD_ADMIN)
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine) PROJECT(TDengine)
IF (${CLUSTER} MATCHES "true")
SET(TD_CLUSTER TRUE)
MESSAGE(STATUS "Build with cluster plugins")
ELSEIF (${CLUSTER} MATCHES "false")
SET(TD_CLUSTER FALSE)
MESSAGE(STATUS "Build without cluster plugins")
ENDIF ()
IF (${ACCOUNT} MATCHES "true") IF (${ACCOUNT} MATCHES "true")
SET(TD_ACCOUNT TRUE) SET(TD_ACCOUNT TRUE)
MESSAGE(STATUS "Build with account plugins") MESSAGE(STATUS "Build with account plugins")
......
...@@ -23,7 +23,7 @@ extern "C" { ...@@ -23,7 +23,7 @@ extern "C" {
int32_t dnodeInitMClient(); int32_t dnodeInitMClient();
void dnodeCleanupMClient(); void dnodeCleanupMClient();
void dnodeSendMsgToMnode(SRpcMsg *rpcMsg); void dnodeSendMsgToMnode(SRpcMsg *rpcMsg);
void * dnodeGetMpeerInfos(); void * dnodeGetMnodeList();
int32_t dnodeGetDnodeId(); int32_t dnodeGetDnodeId();
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -332,7 +332,7 @@ uint32_t dnodeGetMnodeMasteIp() { ...@@ -332,7 +332,7 @@ uint32_t dnodeGetMnodeMasteIp() {
return tsMnodeIpList.ip[tsMnodeIpList.inUse]; return tsMnodeIpList.ip[tsMnodeIpList.inUse];
} }
void* dnodeGetMpeerInfos() { void* dnodeGetMnodeList() {
return &tsMnodeInfos; return &tsMnodeInfos;
} }
......
...@@ -25,9 +25,6 @@ int32_t mgmtStartSystem(); ...@@ -25,9 +25,6 @@ int32_t mgmtStartSystem();
void mgmtCleanUpSystem(); void mgmtCleanUpSystem();
void mgmtStopSystem(); void mgmtStopSystem();
extern char version[];
extern char tsMnodeDir[];
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -20,15 +20,10 @@ ...@@ -20,15 +20,10 @@
extern "C" { extern "C" {
#endif #endif
#include <stdint.h> struct HttpServer;
#include <stdbool.h>
void adminInit(); void adminInitHandle(struct HttpServer* pServer);
void opInitHandle(struct HttpServer* pServer);
struct _http_server_obj_;
extern void (*adminInitHandleFp)(struct _http_server_obj_* pServer);
extern void (*opInitHandleFp)(struct _http_server_obj_* pServer);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#include "mgmtSdb.h" #include "mgmtSdb.h"
#include "mgmtUser.h" #include "mgmtUser.h"
static void * tsAcctSdb = NULL; void * tsAcctSdb = NULL;
static int32_t tsAcctUpdateSize; int32_t tsAcctUpdateSize;
static void mgmtCreateRootAcct(); static void mgmtCreateRootAcct();
static int32_t mgmtActionAcctDestroy(SSdbOperDesc *pOper) { static int32_t mgmtActionAcctDestroy(SSdbOperDesc *pOper) {
SAcctObj *pAcct = pOper->pObj; SAcctObj *pAcct = pOper->pObj;
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
#include "mgmtShell.h" #include "mgmtShell.h"
#include "mgmtUser.h" #include "mgmtUser.h"
int32_t tsMnodeIsMaster = true;
static void * tsMnodeSdb = NULL; static void * tsMnodeSdb = NULL;
static int32_t tsMnodeUpdateSize = 0; static int32_t tsMnodeUpdateSize = 0;
static int32_t tsMnodeIsMaster = true;
static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, void *pConn); static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, void *pConn);
......
...@@ -64,4 +64,7 @@ int32_t replicaAllocVnodes(SVgObj *pVgroup) { ...@@ -64,4 +64,7 @@ int32_t replicaAllocVnodes(SVgObj *pVgroup) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
tsync_h syncStart(const SSyncInfo *info) { return NULL; }
int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle) { return 0; }
#endif #endif
...@@ -15,7 +15,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ...@@ -15,7 +15,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
ADD_LIBRARY(http ${SRC}) ADD_LIBRARY(http ${SRC})
TARGET_LINK_LIBRARIES(http taos_static z) TARGET_LINK_LIBRARIES(http taos_static z)
IF (TD_CLUSTER) IF (TD_ADMIN)
TARGET_LINK_LIBRARIES(http) TARGET_LINK_LIBRARIES(http admin)
ENDIF () ENDIF ()
ENDIF () ENDIF ()
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "taosdef.h" #include "taosdef.h"
#include "tutil.h" #include "tutil.h"
#include "zlib.h" #include "zlib.h"
#include "tlog.h"
#include "http.h" #include "http.h"
#include "httpJson.h" #include "httpJson.h"
...@@ -206,10 +206,10 @@ typedef struct HttpThread { ...@@ -206,10 +206,10 @@ typedef struct HttpThread {
int threadId; int threadId;
char label[HTTP_LABEL_SIZE]; char label[HTTP_LABEL_SIZE];
bool (*processData)(HttpContext *pContext); bool (*processData)(HttpContext *pContext);
struct _http_server_obj_ *pServer; // handle passed by upper layer during pServer initialization struct HttpServer *pServer; // handle passed by upper layer during pServer initialization
} HttpThread; } HttpThread;
typedef struct _http_server_obj_ { typedef struct HttpServer {
char label[HTTP_LABEL_SIZE]; char label[HTTP_LABEL_SIZE];
char serverIp[16]; char serverIp[16];
uint16_t serverPort; uint16_t serverPort;
...@@ -313,4 +313,27 @@ const char* httpContextStateStr(HttpContextState state); ...@@ -313,4 +313,27 @@ const char* httpContextStateStr(HttpContextState state);
bool httpAlterContextState(HttpContext *pContext, HttpContextState srcState, HttpContextState destState); bool httpAlterContextState(HttpContext *pContext, HttpContextState srcState, HttpContextState destState);
void httpRemoveContextFromEpoll(HttpThread *pThread, HttpContext *pContext); void httpRemoveContextFromEpoll(HttpThread *pThread, HttpContext *pContext);
#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__)
#endif #endif
...@@ -13,11 +13,9 @@ ...@@ -13,11 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <arpa/inet.h> #define _DEFAULT_SOURCE
#include <stdint.h> #include "os.h"
#include <string.h> #include "tadmin.h"
#include <unistd.h>
#include "http.h" #include "http.h"
#include "httpCode.h" #include "httpCode.h"
#include "httpHandle.h" #include "httpHandle.h"
...@@ -27,28 +25,17 @@ ...@@ -27,28 +25,17 @@
#include "tglobalcfg.h" #include "tglobalcfg.h"
#include "tsocket.h" #include "tsocket.h"
#include "ttimer.h" #include "ttimer.h"
#include "gcHandle.h" #include "gcHandle.h"
#include "httpHandle.h" #include "httpHandle.h"
#include "restHandle.h" #include "restHandle.h"
#include "tgHandle.h" #include "tgHandle.h"
#include "tlog.h"
#ifndef _ADMIN
void (*adminInitHandleFp)(HttpServer* pServer) = NULL; void adminInitHandle(HttpServer* pServer) {}
void (*opInitHandleFp)(HttpServer* pServer) = NULL; void opInitHandle(HttpServer* pServer) {}
void adminInitHandle(HttpServer* pServer) {
if (adminInitHandleFp) {
(*adminInitHandleFp)(pServer);
}
}
void opInitHandle(HttpServer* pServer) { #endif
if (opInitHandleFp) {
(*opInitHandleFp)(pServer);
}
}
static HttpServer *httpServer = NULL; static HttpServer *httpServer = NULL;
void taosInitNote(int numOfNoteLines, int maxNotes, char* lable); void taosInitNote(int numOfNoteLines, int maxNotes, char* lable);
......
...@@ -13,17 +13,37 @@ ...@@ -13,17 +13,37 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define _DEFAULT_SOURCE
#include "os.h" #include "os.h"
#include "tlog.h"
#include "monitor.h" #include "monitor.h"
#include "dnode.h" #include "dnode.h"
#include "monitorSystem.h"
#include "tsclient.h" #include "tsclient.h"
#include "taosdef.h" #include "taosdef.h"
#include "tsystem.h" #include "tsystem.h"
#include "ttime.h" #include "ttime.h"
#include "ttimer.h" #include "ttimer.h"
#include "tutil.h" #include "tutil.h"
#include "monitorSystem.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__)
#define SQL_LENGTH 1024 #define SQL_LENGTH 1024
#define LOG_LEN_STR 80 #define LOG_LEN_STR 80
......
...@@ -107,8 +107,4 @@ ELSEIF(TD_DARWIN_64) ...@@ -107,8 +107,4 @@ ELSEIF(TD_DARWIN_64)
TARGET_LINK_LIBRARIES(tutil iconv pthread os) TARGET_LINK_LIBRARIES(tutil iconv pthread os)
ENDIF() ENDIF()
#IF (TD_CLUSTER)
# TARGET_LINK_LIBRARIES(tutil mstorage) # TARGET_LINK_LIBRARIES(tutil mstorage)
#ENDIF ()
...@@ -177,48 +177,6 @@ extern uint32_t cdebugFlag; ...@@ -177,48 +177,6 @@ extern uint32_t cdebugFlag;
tprintf("DND QRY ", qdebugFlag, __VA_ARGS__); \ tprintf("DND QRY ", qdebugFlag, __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 #ifdef __cplusplus
} }
#endif #endif
......
...@@ -41,12 +41,6 @@ static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index); ...@@ -41,12 +41,6 @@ static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index);
static void vnodeNotifyRole(void *ahandle, int8_t role); static void vnodeNotifyRole(void *ahandle, int8_t role);
static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT; static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT;
#ifndef _VPEER
tsync_h syncStart(const SSyncInfo *info) { return NULL; }
int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle) { return 0; }
#endif
static void vnodeInit() { static void vnodeInit() {
vnodeInitWriteFp(); vnodeInitWriteFp();
vnodeInitReadFp(); vnodeInitReadFp();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册