qnode.h 1.9 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 {
S
Shengliang Guan 已提交
29 30 31 32 33 34 35 36 37
  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;
D
dapan1121 已提交
38

S
Shengliang Guan 已提交
39
typedef struct {
S
Shengliang Guan 已提交
40
  SMsgCb msgCb;
S
Shengliang Guan 已提交
41 42 43
} SQnodeOpt;

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

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

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

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

H
refact  
Hongze Cheng 已提交
76 77 78 79 80
#ifdef __cplusplus
}
#endif

#endif /*_TD_QNODE_H_*/