tq.h 1.6 KB
Newer Older
H
refact  
Hongze Cheng 已提交
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/>.
 */

L
Liu Jicong 已提交
16 17
#ifndef _TQ_H_
#define _TQ_H_
H
refact  
Hongze Cheng 已提交
18

L
Liu Jicong 已提交
19
#include "executor.h"
L
Liu Jicong 已提交
20
#include "meta.h"
L
Liu Jicong 已提交
21
#include "taoserror.h"
L
Liu Jicong 已提交
22 23
#include "tcommon.h"
#include "tmallocator.h"
L
Liu Jicong 已提交
24
#include "tmsg.h"
L
Liu Jicong 已提交
25
#include "trpc.h"
L
Liu Jicong 已提交
26
#include "ttimer.h"
L
Liu Jicong 已提交
27
#include "tutil.h"
L
Liu Jicong 已提交
28
#include "vnode.h"
L
Liu Jicong 已提交
29
#include "wal.h"
L
Liu Jicong 已提交
30

H
refact  
Hongze Cheng 已提交
31 32 33 34
#ifdef __cplusplus
extern "C" {
#endif

L
Liu Jicong 已提交
35
typedef struct STQ STQ;
L
Liu Jicong 已提交
36

L
Liu Jicong 已提交
37
// memory allocator provided by vnode
L
Liu Jicong 已提交
38
typedef struct {
L
Liu Jicong 已提交
39
  SMemAllocatorFactory* pAllocatorFactory;
L
Liu Jicong 已提交
40 41
  SMemAllocator*        pAllocator;
} STqMemRef;
L
Liu Jicong 已提交
42

L
Liu Jicong 已提交
43 44 45 46
// init once
int  tqInit();
void tqCleanUp();

L
Liu Jicong 已提交
47
// open in each vnode
L
Liu Jicong 已提交
48
STQ* tqOpen(const char* path, SWal* pWal, SMeta* pMeta, STqCfg* tqConfig, SMemAllocatorFactory* allocFac);
L
Liu Jicong 已提交
49
void tqClose(STQ*);
L
Liu Jicong 已提交
50

L
Liu Jicong 已提交
51
// required by vnode
L
Liu Jicong 已提交
52
int tqPushMsg(STQ*, void* msg, tmsg_t msgType, int64_t version);
L
Liu Jicong 已提交
53
int tqCommit(STQ*);
H
refact  
Hongze Cheng 已提交
54

L
Liu Jicong 已提交
55
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg);
L
Liu Jicong 已提交
56
int32_t tqProcessSetConnReq(STQ* pTq, char* msg);
L
Liu Jicong 已提交
57
int32_t tqProcessRebReq(STQ* pTq, char* msg);
L
Liu Jicong 已提交
58

H
refact  
Hongze Cheng 已提交
59 60 61 62
#ifdef __cplusplus
}
#endif

L
Liu Jicong 已提交
63
#endif /*_TQ_H_*/