diff --git a/include/server/dnode.h b/include/server/dnode.h deleted file mode 100644 index 0fe5a66238c13ae755280d719a415c3ac1aca8ab..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..fae60495e9a230a46567c5b7ff32a3152c6bb323 --- /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 d458d3a91fbc231be394e570668f2d849f401e30..0d2fd00ba1e85daf9c10c19c5b464e3b08bc0605 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 6dea4a4e57392be988126c579648f39a8270b9bf..4a848add59ed5f68d292472531f0897a05f169cf 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 ab88d501910345135505097c87ef441bf3c74913..36273abe92db16557292cca5b543c19e1272c575 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