From ce7a1600eb46608e922666466c99e7b449e014f7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 22 Sep 2021 20:29:24 +0800 Subject: [PATCH] TD-10430 --- include/server/dnode.h | 27 ---------- include/server/dnode/dnode.h | 75 +++++++++++++++++++++++++++ include/server/mnode/mnode.h | 41 +++++++++++++++ include/server/vnode/vnode.h | 50 +++++++++++++++++- source/server/CMakeLists.txt | 2 +- source/server/{dnode => taosd}/main.c | 0 6 files changed, 166 insertions(+), 29 deletions(-) delete mode 100644 include/server/dnode.h create mode 100644 include/server/dnode/dnode.h rename source/server/{dnode => taosd}/main.c (100%) diff --git a/include/server/dnode.h b/include/server/dnode.h deleted file mode 100644 index 0fe5a66238..0000000000 --- a/include/server/dnode.h +++ /dev/null @@ -1,27 +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 _TD_DNODE_H_ -#define _TD_DNODE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /*_TD_DNODE_H_*/ \ No newline at end of file diff --git a/include/server/dnode/dnode.h b/include/server/dnode/dnode.h new file mode 100644 index 0000000000..fae60495e9 --- /dev/null +++ b/include/server/dnode/dnode.h @@ -0,0 +1,75 @@ +/* + * 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 _TD_DNODE_H_ +#define _TD_DNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct SRpcMsg; +struct SRpcEpSet; + +/** + * Initialize and start the dnode module + * + * @return Error Code + */ +int32_t dnodeInit(); + +/** + * Stop and cleanup dnode module + */ +void dnodeCleanup(); + +/** + * Send messages to other dnodes, such as create vnode message. + * + * @param epSet The endpoint list of the dnodes. + * @param rpcMsg Message to be sent. + */ +void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg); + +/** + * Send messages to mnode, such as config message. + * + * @param rpcMsg Message to be sent. + */ +void dnodeSendMsgToMnode(SRpcMsg *rpcMsg); + +/** + * Get the corresponding endpoint information from dnodeId. + * + * @param dnodeId + * @param ep The endpoint of dnode + * @param fqdn The fqdn of dnode + * @param port The port of dnode + */ +void dnodeGetDnodeEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port); + +/** + * Report to dnode the start-up steps of other modules + * + * @param name Name of the start-up phase. + * @param desc Description of the start-up phase. + */ +void dnodeReportStartup(char *name, char *desc); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_DNODE_H_*/ \ No newline at end of file diff --git a/include/server/mnode/mnode.h b/include/server/mnode/mnode.h index d458d3a91f..0d2fd00ba1 100644 --- a/include/server/mnode/mnode.h +++ b/include/server/mnode/mnode.h @@ -20,6 +20,47 @@ extern "C" { #endif +struct SRpcMsg; + +/** + * Deploy Mnode instances in Dnode. + * + * @return Error Code. + */ +int32_t mnodeDeploy(); + +/** + * Delete the Mnode instance deployed in Dnode. + */ +void mnodeUnDeploy(); + +/** + * Start Mnode service. + * + * @return Error Code. + */ +int32_t mnodeStart(); + +/** + * Stop Mnode service. + */ +int32_t mnodeStop(); + +/** + * Interface for processing messages. + * + * @param pMsg Message to be processed. + * @return Error code + */ +int32_t mnodeProcessMsg(SRpcMsg *pMsg); + +/** + * Whether the Mnode is in service. + * + * @return Server status. + */ +bool mnodeIsServing(); + #ifdef __cplusplus } #endif diff --git a/include/server/vnode/vnode.h b/include/server/vnode/vnode.h index 6dea4a4e57..4a848add59 100644 --- a/include/server/vnode/vnode.h +++ b/include/server/vnode/vnode.h @@ -11,4 +11,52 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - */ \ No newline at end of file + */ + +#ifndef _TD_VNODE_H_ +#define _TD_VNODE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct SRpcMsg; + +/** + * Start Initialize Vnode module. + * + * @return Error Code. + */ +int32_t vnodeInit(); + +/** + * Cleanup Vnode module. + */ +void vnodeCleanup(); + +typedef struct { + int64_t queryMsgCount; + int64_t writeMsgCount; +} SVnodeStat; + +/** + * Get the statistical information of Vnode + * + * @param stat Statistical information. + * @return Error Code. + */ +int32_t vnodeGetStatistics(SVnodeStat *stat); + +/** + * Interface for processing messages. + * + * @param pMsg Message to be processed. + * @return Error code + */ +int32_t vnodeProcessMsg(SRpcMsg *pMsg); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_VNODE_H_*/ \ No newline at end of file diff --git a/source/server/CMakeLists.txt b/source/server/CMakeLists.txt index ab88d50191..36273abe92 100644 --- a/source/server/CMakeLists.txt +++ b/source/server/CMakeLists.txt @@ -2,7 +2,7 @@ add_subdirectory(mnode) add_subdirectory(vnode) add_subdirectory(qnode) -aux_source_directory(dnode TAOSD_SRC) +aux_source_directory(taosd TAOSD_SRC) add_executable(taosd ${TAOSD_SRC}) target_link_libraries( taosd diff --git a/source/server/dnode/main.c b/source/server/taosd/main.c similarity index 100% rename from source/server/dnode/main.c rename to source/server/taosd/main.c -- GitLab