qworker.h 2.5 KB
Newer Older
D
dapan1121 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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/>.
 */

D
dapan1121 已提交
16 17
#ifndef _TD_QWORKER_H_
#define _TD_QWORKER_H_
D
dapan1121 已提交
18 19 20 21 22

#ifdef __cplusplus
extern "C" {
#endif

D
dapan1121 已提交
23 24
#include "trpc.h"

D
dapan1121 已提交
25 26 27 28 29 30 31 32 33

enum {
  NODE_TYPE_VNODE = 1,
  NODE_TYPE_QNODE,
  NODE_TYPE_SNODE,
};



D
dapan1121 已提交
34 35
typedef struct SQWorkerCfg {
  uint32_t maxSchedulerNum;
D
dapan1121 已提交
36
  uint32_t maxTaskNum;
D
dapan1121 已提交
37
  uint32_t maxSchTaskNum;
D
dapan1121 已提交
38 39 40 41 42 43 44 45 46 47 48 49 50
} SQWorkerCfg;

typedef struct {
  uint64_t numOfStartTask;
  uint64_t numOfStopTask;
  uint64_t numOfRecvedFetch;
  uint64_t numOfSentHb;
  uint64_t numOfSentFetch;
  uint64_t numOfTaskInQueue;
  uint64_t numOfFetchInQueue;
  uint64_t numOfErrors;
} SQWorkerStat;

D
dapan1121 已提交
51
typedef int32_t (*putReqToQueryQFp)(void *, struct SRpcMsg *);
S
shm  
Shengliang Guan 已提交
52
typedef int32_t (*sendReqFp)(void *, struct SEpSet *, struct SRpcMsg *);
D
dapan1121 已提交
53

S
Shengliang 已提交
54
int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, SQWorkerCfg *cfg, void **qWorkerMgmt, void *nodeObj,
S
shm  
Shengliang Guan 已提交
55
                    putReqToQueryQFp fp1, sendReqFp fp2);
D
dapan1121 已提交
56

D
dapan1121 已提交
57
int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
58

59
int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
60 61 62

int32_t qWorkerProcessDataSinkMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);

D
dapan1121 已提交
63
int32_t qWorkerProcessReadyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
64

D
dapan1121 已提交
65
int32_t qWorkerProcessStatusMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
66

D
dapan1121 已提交
67
int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
68

S
Shengliang 已提交
69 70
int32_t qWorkerProcessFetchRsp(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);

D
dapan1121 已提交
71
int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
72

D
dapan1121 已提交
73
int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
74

D
dapan1121 已提交
75 76
int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);

H
Haojun Liao 已提交
77 78 79
int32_t qWorkerProcessShowMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);

int32_t qWorkerProcessShowFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg);
D
dapan1121 已提交
80

H
Haojun Liao 已提交
81
void qWorkerDestroy(void **qWorkerMgmt);
D
dapan1121 已提交
82 83 84 85 86

#ifdef __cplusplus
}
#endif

D
dapan1121 已提交
87
#endif /*_TD_QWORKER_H_*/