Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0f3db7d7
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0f3db7d7
编写于
10月 08, 2021
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tq header
上级
e8e4af01
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
55 addition
and
18 deletion
+55
-18
CMakeLists.txt
CMakeLists.txt
+1
-1
include/client/consumer/consumer.h
include/client/consumer/consumer.h
+14
-10
include/server/vnode/tq/tq.h
include/server/vnode/tq/tq.h
+18
-2
source/client/consumer/consumer.c
source/client/consumer/consumer.c
+3
-1
source/server/vnode/tq/CMakeLists.txt
source/server/vnode/tq/CMakeLists.txt
+6
-1
source/server/vnode/tq/inc/tqInt.h
source/server/vnode/tq/inc/tqInt.h
+4
-1
source/server/vnode/tq/src/tq.c
source/server/vnode/tq/src/tq.c
+9
-2
未找到文件。
CMakeLists.txt
浏览文件 @
0f3db7d7
...
...
@@ -54,4 +54,4 @@ add_library(api INTERFACE ${API_SRC})
# src
add_subdirectory
(
source
)
# tests (TODO)
\ No newline at end of file
# tests (TODO)
include/client/consumer/consumer.h
浏览文件 @
0f3db7d7
...
...
@@ -16,6 +16,10 @@
#ifndef _TD_CONSUMER_H_
#define _TD_CONSUMER_H_
#include "tlist.h"
#include "tarray.h"
#include "hash.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -32,16 +36,15 @@ extern "C" {
struct
tmq_resp_err_t
;
typedef
struct
tmq_resp_err_t
tmq_resp_err_t
;
//topic list
//resouces are supposed to be free by users by calling tmq_list_destroy
struct
tmq_topic_list_t
;
typedef
struct
tmq_topic_list_t
tmq_topic_list_t
;
int32_t
tmq_topic_list_add
(
tmq_topic_list_t
*
,
const
char
*
);
void
tmq_topic_list_destroy
(
tmq_topic_list_t
*
);
struct
tmq_message_t
;
typedef
struct
tmq_message_t
tmq_message_t
;
struct
tmq_col_batch_t
;
typedef
struct
tmq_col_batch_t
tmq_col_batch_t
;
//get content of message
tmq_col_batch_t
*
tmq_get_msg_col_by_idx
(
tmq_message_t
*
,
int32_t
);
tmq_col_batch_t
*
tmq_get_msg_col_by_name
(
tmq_message_t
*
,
const
char
*
);
tmq_col_batch_t
*
tmq_get_msg_col_by_idx
(
tmq_message_t
*
,
int32_t
col_id
);
tmq_col_batch_t
*
tmq_get_msg_col_by_name
(
tmq_message_t
*
,
const
char
*
);
//consumer config
int32_t
tmq_conf_set
(
tmq_consumer_config_t
*
,
const
char
*
config_key
,
const
char
*
config_value
,
char
*
errstr
,
int32_t
errstr_cap
);
...
...
@@ -51,11 +54,12 @@ extern "C" {
tmq_consumer_t
*
tmq_consumer_new
(
tmq_consumer_config_t
*
,
char
*
errstr
,
int32_t
errstr_cap
);
//subscribe
tmq_resp_err_t
tmq_subscribe
(
tmq_consumer_t
*
,
const
tmq_topic_list_t
*
);
tmq_resp_err_t
tmq_subscribe
(
tmq_consumer_t
*
,
const
SList
*
);
tmq_resp_err_t
tmq_unsubscribe
(
tmq_consumer_t
*
);
//consume
//resouces are supposed to be free by users by calling tmq_message_destroy
tmq_message_t
tmq_consume_poll
(
tmq_consumer_t
*
,
int64_t
blocking_time
);
tmq_message_t
*
tmq_consume_poll
(
tmq_consumer_t
*
,
int64_t
blocking_time
);
//destroy message and free memory
void
tmq_message_destroy
(
tmq_message_t
*
);
...
...
include/server/vnode/tq/tq.h
浏览文件 @
0f3db7d7
...
...
@@ -16,17 +16,33 @@
#ifndef _TD_TQ_H_
#define _TD_TQ_H_
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
STQ
STQ
;
int
tqPushMsg
(
void
*
);
STQ
*
tqInit
();
void
tqCleanUp
(
STQ
*
pTQ
);
//create persistent storage for meta info such as consuming offset
//return value > 0: cgId
//return value < 0: error code
int
tqCreateGroup
(
STQ
*
pTQ
);
//create ring buffer in memory and load consuming offset
int
tqOpenGroup
(
STQ
*
pTQ
,
int
cgId
);
//destroy ring buffer and persist consuming offset
int
tqCloseGroup
(
STQ
*
pTQ
,
int
cgId
);
//delete persistent storage for meta info
int
tqDropGroup
(
STQ
*
pTQ
);
int
tqPushMsg
(
STQ
*
pTQ
,
void
*
,
int64_t
version
);
int
tqCommit
(
STQ
*
pTQ
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TQ_H_*/
\ No newline at end of file
#endif
/*_TD_TQ_H_*/
source/client/consumer/consumer.c
浏览文件 @
0f3db7d7
...
...
@@ -11,4 +11,6 @@
*
* 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/>.
*/
\ No newline at end of file
*/
#include "consumer.h"
source/server/vnode/tq/CMakeLists.txt
浏览文件 @
0f3db7d7
...
...
@@ -3,5 +3,10 @@ add_library(tq ${TQ_SRC})
target_include_directories
(
tq
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/vnode/tq"
PRIVATE
"
${
CMAKE_SOURCE_DIR
}
/include/os"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
\ No newline at end of file
)
target_link_libraries
(
os
)
source/server/vnode/tq/inc/tqInt.h
浏览文件 @
0f3db7d7
...
...
@@ -20,8 +20,11 @@
extern
"C"
{
#endif
//implement the array index
//implement the ring buffer
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TQ_INT_H_*/
\ No newline at end of file
#endif
/*_TD_TQ_INT_H_*/
source/server/vnode/tq/src/tq.c
浏览文件 @
0f3db7d7
...
...
@@ -15,5 +15,12 @@
#include "tq.h"
int
tqPushMsg
(
void
*
p
)
{
return
0
;}
int
tqCommit
(
STQ
*
pTQ
)
{
return
0
;}
int
tqPushMsg
(
STQ
*
pTQ
,
void
*
p
,
int64_t
version
)
{
//add reference
//
return
0
;
}
int
tqCommit
(
STQ
*
pTQ
)
{
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录