TDengine/include/dnode/qnode/qnode.h

90 lines
2.5 KiB
C
Raw Normal View History

2021-09-22 05:21:07 +00:00
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_QNODE_H_
#define _TD_QNODE_H_
#ifdef __cplusplus
extern "C" {
#endif
2021-12-27 10:43:27 +00:00
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef struct SDnode SDnode;
typedef struct SQnode SQnode;
2022-01-12 03:24:39 +00:00
typedef int32_t (*SendReqToDnodeFp)(SDnode *pDnode, struct SEpSet *epSet, struct SRpcMsg *pMsg);
typedef int32_t (*SendReqToMnodeFp)(SDnode *pDnode, struct SRpcMsg *pMsg);
typedef void (*SendRedirectRspFp)(SDnode *pDnode, struct SRpcMsg *pMsg);
2021-10-08 05:35:55 +00:00
typedef struct {
2021-12-27 10:43:27 +00:00
int64_t numOfStartTask;
int64_t numOfStopTask;
int64_t numOfRecvedFetch;
int64_t numOfSentHb;
int64_t numOfSentFetch;
int64_t numOfTaskInQueue;
int64_t numOfFetchInQueue;
int64_t numOfErrors;
} SQnodeLoad;
2021-10-08 05:35:55 +00:00
2021-12-27 10:43:27 +00:00
typedef struct {
2022-01-12 03:24:39 +00:00
int32_t sver;
2021-12-27 10:43:27 +00:00
int32_t dnodeId;
int64_t clusterId;
SDnode *pDnode;
2022-01-04 11:44:44 +00:00
SendReqToDnodeFp sendReqToDnodeFp;
SendReqToMnodeFp sendReqToMnodeFp;
SendRedirectRspFp sendRedirectRspFp;
2021-12-27 10:43:27 +00:00
} SQnodeOpt;
/* ------------------------ SQnode ------------------------ */
2021-10-08 05:35:55 +00:00
/**
2021-12-27 10:43:27 +00:00
* @brief Start one Qnode in Dnode.
*
* @param pOption Option of the qnode.
* @return SQnode* The qnode object.
2021-10-08 05:35:55 +00:00
*/
2021-12-27 10:43:27 +00:00
SQnode *qndOpen(const SQnodeOpt *pOption);
2021-10-08 05:35:55 +00:00
/**
2021-12-27 10:43:27 +00:00
* @brief Stop Qnode in Dnode.
2021-10-08 05:35:55 +00:00
*
2021-12-27 10:43:27 +00:00
* @param pQnode The qnode object to close.
2021-10-08 05:35:55 +00:00
*/
2021-12-27 10:43:27 +00:00
void qndClose(SQnode *pQnode);
2021-10-08 05:35:55 +00:00
/**
2021-12-27 10:43:27 +00:00
* @brief Get the statistical information of Qnode
2021-10-08 05:35:55 +00:00
*
2021-12-27 10:43:27 +00:00
* @param pQnode The qnode object.
* @param pLoad Statistics of the qnode.
* @return int32_t 0 for success, -1 for failure.
2021-10-08 05:35:55 +00:00
*/
2021-12-27 10:43:27 +00:00
int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad);
2021-10-08 05:35:55 +00:00
/**
2021-12-28 03:57:24 +00:00
* @brief Process a query or fetch message.
2021-12-27 10:43:27 +00:00
*
* @param pQnode The qnode object.
* @param pMsg The request message
* @param pRsp The response message
* @return int32_t 0 for success, -1 for failure
2021-10-08 05:35:55 +00:00
*/
2021-12-28 03:57:24 +00:00
int32_t qndProcessMsg(SQnode *pQnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
2021-10-08 05:35:55 +00:00
2021-09-22 05:21:07 +00:00
#ifdef __cplusplus
}
#endif
#endif /*_TD_QNODE_H_*/