TDengine/include/dnode/qnode/qnode.h

80 lines
1.9 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_
2022-03-21 11:08:25 +00:00
#include "tmsgcb.h"
2021-09-22 05:21:07 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2021-12-27 10:43:27 +00:00
/* ------------------------ TYPES EXPOSED ------------------------ */
2022-03-21 11:08:25 +00:00
typedef struct SQnode SQnode;
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-03-21 11:08:25 +00:00
SMsgCb msgCb;
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
2021-10-08 05:35:55 +00:00
*/
2022-03-21 11:49:20 +00:00
int32_t qndProcessQueryMsg(SQnode *pQnode, SRpcMsg *pMsg);
2021-10-08 05:35:55 +00:00
2021-09-22 05:21:07 +00:00
#ifdef __cplusplus
}
#endif
#endif /*_TD_QNODE_H_*/