qnode.h 1.7 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

S
Shengliang Guan 已提交
28
typedef struct {
S
Shengliang Guan 已提交
29
  SMsgCb msgCb;
S
Shengliang Guan 已提交
30 31 32
} SQnodeOpt;

/* ------------------------ SQnode ------------------------ */
D
dapan1121 已提交
33
/**
S
Shengliang Guan 已提交
34 35 36 37
 * @brief Start one Qnode in Dnode.
 *
 * @param pOption Option of the qnode.
 * @return SQnode* The qnode object.
D
dapan1121 已提交
38
 */
S
Shengliang Guan 已提交
39
SQnode *qndOpen(const SQnodeOpt *pOption);
D
dapan1121 已提交
40 41

/**
S
Shengliang Guan 已提交
42
 * @brief Stop Qnode in Dnode.
D
dapan1121 已提交
43
 *
S
Shengliang Guan 已提交
44
 * @param pQnode The qnode object to close.
D
dapan1121 已提交
45
 */
S
Shengliang Guan 已提交
46
void qndClose(SQnode *pQnode);
D
dapan1121 已提交
47 48

/**
S
Shengliang Guan 已提交
49
 * @brief Get the statistical information of Qnode
D
dapan1121 已提交
50
 *
S
Shengliang Guan 已提交
51 52 53
 * @param pQnode The qnode object.
 * @param pLoad Statistics of the qnode.
 * @return int32_t 0 for success, -1 for failure.
D
dapan1121 已提交
54
 */
S
Shengliang Guan 已提交
55
int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad);
D
dapan1121 已提交
56 57

/**
S
Shengliang Guan 已提交
58
 * @brief Process a query or fetch message.
S
Shengliang Guan 已提交
59 60 61
 *
 * @param pQnode The qnode object.
 * @param pMsg The request message
D
dapan1121 已提交
62
 */
D
dapan1121 已提交
63
int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg);
D
dapan1121 已提交
64

H
refact  
Hongze Cheng 已提交
65 66 67 68
#ifdef __cplusplus
}
#endif

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