From e0e55b2d6510e8d1420a8bc8852a9a9f0797c495 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 23 Nov 2022 22:08:35 +0800 Subject: [PATCH] refactor: do some internal refactor. --- include/common/tdatablock.h | 13 -------- include/common/tmisce.h | 42 +++++++++++++++++++++++++ source/client/inc/clientInt.h | 2 +- source/client/src/clientMain.c | 2 +- source/client/src/clientMsgHandler.c | 1 + source/common/src/tglobal.c | 2 +- source/common/src/tmisce.c | 2 +- source/dnode/mgmt/node_util/src/dmEps.c | 1 + source/dnode/mnode/impl/src/mndDnode.c | 1 + source/dnode/mnode/impl/src/mndMnode.c | 2 +- source/dnode/mnode/impl/src/mndVgroup.c | 1 + 11 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 include/common/tmisce.h diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 502ba10d33..76ab2f7c3f 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -24,11 +24,6 @@ extern "C" { #endif -typedef struct SCorEpSet { - int32_t version; - SEpSet epSet; -} SCorEpSet; - typedef struct SBlockOrderInfo { bool nullFirst; int32_t order; @@ -36,14 +31,6 @@ typedef struct SBlockOrderInfo { SColumnInfoData* pColData; } SBlockOrderInfo; -int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp); -void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port); - -bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2); - -void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet); -SEpSet getEpSet_s(SCorEpSet* pEpSet); - #define NBIT (3u) #define BitPos(_n) ((_n) & ((1 << NBIT) - 1)) #define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT]) diff --git a/include/common/tmisce.h b/include/common/tmisce.h new file mode 100644 index 0000000000..b9f5cf5b91 --- /dev/null +++ b/include/common/tmisce.h @@ -0,0 +1,42 @@ +/* + * 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 TDENGINE_TMISCE_H +#define TDENGINE_TMISCE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "tmsg.h" + +typedef struct SCorEpSet { + int32_t version; + SEpSet epSet; +} SCorEpSet; + +int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp); +void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port); + +bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2); + +void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet); +SEpSet getEpSet_s(SCorEpSet* pEpSet); + +#ifdef __cplusplus +} +#endif + +#endif // TDENGINE_TMISCE_H diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index e569a97723..aae20c587d 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -26,7 +26,7 @@ extern "C" { #include "query.h" #include "taos.h" #include "tcommon.h" -#include "tdatablock.h" +#include "tmisce.h" #include "tdef.h" #include "thash.h" #include "tlist.h" diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index efa7d095c5..a84f9e6bb0 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -20,13 +20,13 @@ #include "functionMgt.h" #include "os.h" #include "query.h" -#include "qworker.h" #include "scheduler.h" #include "tglobal.h" #include "tmsg.h" #include "tref.h" #include "trpc.h" #include "version.h" +#include "tdatablock.h" #define TSC_VAR_NOT_RELEASE 1 #define TSC_VAR_RELEASED 0 diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 591d469d7c..a49d072569 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -20,6 +20,7 @@ #include "query.h" #include "tdef.h" #include "tname.h" +#include "tdatablock.h" static void setErrno(SRequestObj* pRequest, int32_t code) { pRequest->code = code; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 0db3e99863..d82ad5c15a 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "tglobal.h" #include "tconfig.h" -#include "tdatablock.h" +#include "tmisce.h" #include "tgrant.h" #include "tlog.h" diff --git a/source/common/src/tmisce.c b/source/common/src/tmisce.c index dfaebc99f6..dfb1917fcf 100644 --- a/source/common/src/tmisce.c +++ b/source/common/src/tmisce.c @@ -14,7 +14,7 @@ */ #define _DEFAULT_SOURCE -#include "tdatablock.h" +#include "tmisce.h" #include "tglobal.h" #include "tlog.h" #include "tname.h" diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c index 7fe7d44827..4bc2e64fad 100644 --- a/source/dnode/mgmt/node_util/src/dmEps.c +++ b/source/dnode/mgmt/node_util/src/dmEps.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "dmUtil.h" +#include "tmisce.h" static void dmPrintEps(SDnodeData *pData); static bool dmIsEpChanged(SDnodeData *pData, int32_t dnodeId, const char *ep); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 521f924fad..2a3ecf1924 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -24,6 +24,7 @@ #include "mndTrans.h" #include "mndUser.h" #include "mndVgroup.h" +#include "tmisce.h" #define TSDB_DNODE_VER_NUMBER 1 #define TSDB_DNODE_RESERVE_SIZE 64 diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 563b3cd3cf..b02ca4c773 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -20,7 +20,7 @@ #include "mndShow.h" #include "mndSync.h" #include "mndTrans.h" -#include "mndUser.h" +#include "tmisce.h" #define MNODE_VER_NUMBER 1 #define MNODE_RESERVE_SIZE 64 diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index e00d0d955e..5555335765 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -22,6 +22,7 @@ #include "mndShow.h" #include "mndTrans.h" #include "mndUser.h" +#include "tmisce.h" #define VGROUP_VER_NUMBER 1 #define VGROUP_RESERVE_SIZE 64 -- GitLab