tqueue.h 1.9 KB
Newer Older
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
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/>.
 */

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
16 17
#ifndef TAOS_QUEUE_H
#define TAOS_QUEUE_H
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
18 19 20 21 22

#ifdef __cplusplus
extern "C" {
#endif

23 24 25 26
#define TAOS_QTYPE_RPC      0
#define TAOS_QTYPE_FWD      1
#define TAOS_QTYPE_WAL      2 

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
27 28 29
typedef void* taos_queue;
typedef void* taos_qset;
typedef void* taos_qall;
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
30

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
31
taos_queue taosOpenQueue();
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
32
void       taosCloseQueue(taos_queue);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
33 34 35 36
void      *taosAllocateQitem(int size);
void       taosFreeQitem(void *item);
int        taosWriteQitem(taos_queue, int type, void *item);
int        taosReadQitem(taos_queue, int *type, void **pitem);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
37

38 39 40
taos_qall  taosAllocateQall();
void       taosFreeQall(taos_qall);
int        taosReadAllQitems(taos_queue, taos_qall);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
41
int        taosGetQitem(taos_qall, int *type, void **pitem);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
42 43 44 45
void       taosResetQitems(taos_qall);

taos_qset  taosOpenQset();
void       taosCloseQset();
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
46
int        taosAddIntoQset(taos_qset, taos_queue, void *ahandle);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
47 48 49
void       taosRemoveFromQset(taos_qset, taos_queue);
int        taosGetQueueNumber(taos_qset);

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
50
int        taosReadQitemFromQset(taos_qset, int *type, void **pitem, void **handle);
51
int        taosReadAllQitemsFromQset(taos_qset, taos_qall, void **handle);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
52 53 54

int        taosGetQueueItemsNumber(taos_queue param);
int        taosGetQsetItemsNumber(taos_qset param);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
55 56 57 58 59

#ifdef __cplusplus
}
#endif

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
60 61 62
#endif