qnode.h 2.0 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * 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_

S
Shengliang Guan 已提交
19 20
#include "tmsgcb.h"

H
refact  
Hongze Cheng 已提交
21 22 23
#ifdef __cplusplus
extern "C" {
#endif
S
Shengliang Guan 已提交
24 25

/* ------------------------ TYPES EXPOSED ------------------------ */
S
Shengliang Guan 已提交
26
typedef struct SQnode SQnode;
D
dapan1121 已提交
27 28

typedef struct {
D
dapan1121 已提交
29 30 31 32 33 34 35 36
  int64_t numOfProcessedQuery;
  int64_t numOfProcessedCQuery;
  int64_t numOfProcessedFetch;
  int64_t numOfProcessedDrop;
  int64_t memSizeInCache;
  int64_t dataSizeSend;
  int64_t dataSizeRecv;
  int64_t numOfQueryInQueue;
S
Shengliang Guan 已提交
37
  int64_t numOfFetchInQueue;
D
dapan1121 已提交
38 39
  int64_t waitTimeInQueryQUeue;
  int64_t waitTimeInFetchQUeue;
S
Shengliang Guan 已提交
40
} SQnodeLoad;
D
dapan1121 已提交
41

S
Shengliang Guan 已提交
42
typedef struct {
S
Shengliang Guan 已提交
43
  SMsgCb msgCb;
S
Shengliang Guan 已提交
44 45 46
} SQnodeOpt;

/* ------------------------ SQnode ------------------------ */
D
dapan1121 已提交
47
/**
S
Shengliang Guan 已提交
48 49 50 51
 * @brief Start one Qnode in Dnode.
 *
 * @param pOption Option of the qnode.
 * @return SQnode* The qnode object.
D
dapan1121 已提交
52
 */
S
Shengliang Guan 已提交
53
SQnode *qndOpen(const SQnodeOpt *pOption);
D
dapan1121 已提交
54 55

/**
S
Shengliang Guan 已提交
56
 * @brief Stop Qnode in Dnode.
D
dapan1121 已提交
57
 *
S
Shengliang Guan 已提交
58
 * @param pQnode The qnode object to close.
D
dapan1121 已提交
59
 */
S
Shengliang Guan 已提交
60
void qndClose(SQnode *pQnode);
D
dapan1121 已提交
61 62

/**
S
Shengliang Guan 已提交
63
 * @brief Get the statistical information of Qnode
D
dapan1121 已提交
64
 *
S
Shengliang Guan 已提交
65 66 67
 * @param pQnode The qnode object.
 * @param pLoad Statistics of the qnode.
 * @return int32_t 0 for success, -1 for failure.
D
dapan1121 已提交
68
 */
S
Shengliang Guan 已提交
69
int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad);
D
dapan1121 已提交
70 71

/**
S
Shengliang Guan 已提交
72
 * @brief Process a query or fetch message.
S
Shengliang Guan 已提交
73 74 75
 *
 * @param pQnode The qnode object.
 * @param pMsg The request message
D
dapan1121 已提交
76
 */
D
dapan1121 已提交
77
int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg);
D
dapan1121 已提交
78

H
refact  
Hongze Cheng 已提交
79 80 81 82
#ifdef __cplusplus
}
#endif

D
dapan1121 已提交
83
#endif /*_TD_QNODE_H_*/