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/>.
 */

H
refact  
Hongze Cheng 已提交
16 17
#ifndef _TD_TQ_H_
#define _TD_TQ_H_
H
refact  
Hongze Cheng 已提交
18

L
Liu Jicong 已提交
19
#include "common.h"
L
Liu Jicong 已提交
20
#include "executor.h"
L
Liu Jicong 已提交
21
#include "mallocator.h"
L
Liu Jicong 已提交
22
#include "meta.h"
L
Liu Jicong 已提交
23
#include "os.h"
L
Liu Jicong 已提交
24
#include "scheduler.h"
L
Liu Jicong 已提交
25
#include "taoserror.h"
L
Liu Jicong 已提交
26
#include "tlist.h"
L
Liu Jicong 已提交
27
#include "tmsg.h"
L
Liu Jicong 已提交
28
#include "trpc.h"
L
Liu Jicong 已提交
29
#include "ttimer.h"
L
Liu Jicong 已提交
30
#include "tutil.h"
L
Liu Jicong 已提交
31
#include "vnode.h"
L
Liu Jicong 已提交
32
#include "wal.h"
L
Liu Jicong 已提交
33

H
refact  
Hongze Cheng 已提交
34 35 36 37
#ifdef __cplusplus
extern "C" {
#endif

L
Liu Jicong 已提交
38
typedef struct STQ STQ;
L
Liu Jicong 已提交
39

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

L
Liu Jicong 已提交
46 47 48 49
// init once
int  tqInit();
void tqCleanUp();

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

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

S
Shengliang 已提交
58
int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg);
L
Liu Jicong 已提交
59
int32_t tqProcessSetConnReq(STQ* pTq, char* msg);
L
Liu Jicong 已提交
60
int32_t tqProcessRebReq(STQ* pTq, char* msg);
L
Liu Jicong 已提交
61

H
refact  
Hongze Cheng 已提交
62 63 64 65
#ifdef __cplusplus
}
#endif

L
Liu Jicong 已提交
66
#endif /*_TD_TQ_H_*/