Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
274d115a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
274d115a
编写于
11月 19, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
89f9caea
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
86 addition
and
40 deletion
+86
-40
include/common/trow.h
include/common/trow.h
+58
-34
include/common/tschema.h
include/common/tschema.h
+18
-0
include/dnode/vnode/meta/meta.h
include/dnode/vnode/meta/meta.h
+7
-5
source/common/src/trow.c
source/common/src/trow.c
+3
-1
未找到文件。
include/common/trow.h
浏览文件 @
274d115a
...
...
@@ -17,53 +17,77 @@
#define _TD_COMMON_ROW_H_
#include "os.h"
#include "tbuffer.h"
#include "tdef.h"
#ifdef __cplusplus
extern
"C"
{
#endif
// types
typedef
void
*
SRow
;
typedef
struct
SRowBatch
SRowBatch
;
typedef
struct
SRowBuilder
SRowBuilder
;
typedef
struct
SRowBatchIter
SRowBatchIter
;
typedef
struct
SRowBatchBuilder
SRowBatchBuilder
;
#define TD_OR_ROW 0
#define TD_KV_ROW 1
// SRow
#define ROW_HEADER_SIZE (sizeof(uint8_t) + 2 * sizeof(uint16_t) + sizeof(uint64_t))
#define rowType(r) (*(uint8_t *)(r)) // row type
#define rowLen(r) (*(uint16_t *)POINTER_SHIFT(r, sizeof(uint8_t))) // row length
#define rowSVer(r) \
(*(uint16_t *)POINTER_SHIFT(r, sizeof(uint8_t) + sizeof(uint16_t))) // row schema version, only for SDataRow
#define rowNCols(r) rowSVer(r) // only for SKVRow
#define rowVer(r) (*(uint64_t)POINTER_SHIFT(r, sizeof(uint8_t) + 2 * sizeof(uint16_t))) // row version
#define rowCopy(dest, r) memcpy((dest), r, rowLen(r))
typedef
uint16_t
col_id_t
;
static
FORCE_INLINE
SRow
rowDup
(
SRow
row
)
{
SRow
r
=
malloc
(
rowLen
(
row
));
if
(
r
==
NULL
)
{
return
NULL
;
}
typedef
struct
{
TSKEY
ts
;
}
SOrRow
;
rowCopy
(
r
,
row
);
typedef
struct
{
col_id_t
cid
;
uint32_t
offset
;
}
SKvRowIdx
;
return
r
;
}
typedef
struct
{
uint16_t
ncols
;
SKvRowIdx
cidx
[];
}
SKvRow
;
typedef
struct
{
union
{
/// union field for encode and decode
uint64_t
info
;
struct
{
/// row type
uint64_t
type
:
2
;
/// row schema version
uint64_t
sver
:
16
;
/// row total length
uint64_t
len
:
46
;
};
};
/// row version
uint64_t
ver
;
/// timestamp of the row
TSKEY
ts
;
char
content
[];
}
SRow
;
// SRowBatch
typedef
enum
{
/// ordinary row builder
TD_OR_ROW_BUILDER
=
0
,
/// kv row builder
TD_KV_ROW_BUILDER
,
/// self-determined row builder
TD_SD_ROW_BUILDER
}
ERowBbuilderT
;
// SRowBuilder
SRowBuilder
*
rowBuilderCreate
();
void
rowBuilderDestroy
(
SRowBuilder
*
);
typedef
struct
{
/// row builder type
ERowBbuilderT
type
;
/// buffer writer
SBufferWriter
bw
;
/// target row
SRow
*
pRow
;
}
SRowBuilder
;
// SRowBatchIter
SRowBatchIter
*
rowBatchIterCreate
(
SRowBatch
*
);
void
rowBatchIterDestroy
(
SRowBatchIter
*
);
const
SRow
rowBatchIterNext
(
SRowBatchIter
*
);
typedef
struct
{
/* TODO */
}
SRowBatchBuilder
;
// SRowBatchBuilder
SRowBatchBuilder
*
rowBatchBuilderCreate
();
void
rowBatchBuilderDestroy
(
SRowBatchBuilder
*
);
#define tRBInit(type, allocator, endian) \
{ .type = (type), tbufInitWriter(allocator, endian), NULL }
void
tRBClear
(
SRowBuilder
*
pRB
);
#ifdef __cplusplus
}
...
...
include/common/tschema.h
浏览文件 @
274d115a
...
...
@@ -16,10 +16,28 @@
#ifndef _TD_COMMON_SCHEMA_H_
#define _TD_COMMON_SCHEMA_H_
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SColAttr
{
/* data */
}
SColAttr
;
typedef
struct
SColumn
{
uint8_t
type
;
uint16_t
cid
;
uint16_t
bytes
;
}
SColumn
;
typedef
struct
SSchema
{
/// schema version
uint16_t
sver
;
/* data */
}
SSchema
;
#ifdef __cplusplus
}
#endif
...
...
include/dnode/vnode/meta/meta.h
浏览文件 @
274d115a
...
...
@@ -41,11 +41,13 @@ void metaOptionsClear(SMetaOptions *pOptions);
// STableOpts
#define META_TABLE_OPTS_DECLARE(name) STableOpts name = {0}
void
metaNormalTableOptsInit
(
STbOptions
*
pTbOptions
,
const
char
*
name
,
const
STSchema
*
pSchema
);
void
metaSuperTableOptsInit
(
STbOptions
*
pTbOptions
,
const
char
*
name
,
tb_uid_t
uid
,
const
STSchema
*
pSchema
,
const
STSchema
*
pTagSchema
);
void
metaChildTableOptsInit
(
STbOptions
*
pTbOptions
,
const
char
*
name
,
tb_uid_t
suid
,
const
SKVRow
tags
);
void
metaTableOptsClear
(
STbOptions
*
pTbOptions
);
void
metaNormalTableOptsInit
(
STbOptions
*
pTbOptions
,
const
char
*
name
,
const
STSchema
*
pSchema
);
void
metaSuperTableOptsInit
(
STbOptions
*
pTbOptions
,
const
char
*
name
,
tb_uid_t
uid
,
const
STSchema
*
pSchema
,
const
STSchema
*
pTagSchema
);
void
metaChildTableOptsInit
(
STbOptions
*
pTbOptions
,
const
char
*
name
,
tb_uid_t
suid
,
const
SKVRow
tags
);
void
metaTableOptsClear
(
STbOptions
*
pTbOptions
);
uint64_t
metaEncodeTbOptions
(
void
**
pBuf
,
STbOptions
*
pTbOptions
);
STbOptions
*
metaDecodeTbOptions
(
void
*
pBuf
,
size_t
size
,
bool
endian
);
#ifdef __cplusplus
}
...
...
source/common/src/trow.c
浏览文件 @
274d115a
...
...
@@ -15,6 +15,7 @@
#include "trow.h"
#if 0
/* ------------ Structures ---------- */
struct SRowBatch {
int32_t compress : 1; // if batch row is compressed
...
...
@@ -86,4 +87,5 @@ const SRow rowBatchIterNext(SRowBatchIter *pRowBatchIter) {
// SRowBatchBuilder
SRowBatchBuilder *rowBatchBuilderCreate();
void
rowBatchBuilderDestroy
(
SRowBatchBuilder
*
);
\ No newline at end of file
void rowBatchBuilderDestroy(SRowBatchBuilder *);
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录