Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bab6e54b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bab6e54b
编写于
10月 11, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
partial SRow code
上级
1b6c7a59
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
120 addition
and
6 deletion
+120
-6
include/common/trow.h
include/common/trow.h
+43
-5
source/common/src/trow.c
source/common/src/trow.c
+76
-1
source/server/vnode/meta/test/metaTests.cpp
source/server/vnode/meta/test/metaTests.cpp
+1
-0
未找到文件。
include/common/trow.h
浏览文件 @
bab6e54b
...
...
@@ -16,16 +16,54 @@
#ifndef _TD_COMMON_ROW_H_
#define _TD_COMMON_ROW_H_
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SRow
SRow
;
// types
typedef
void
*
SRow
;
typedef
struct
SRowBatch
SRowBatch
;
typedef
struct
SRowBuilder
SRowBuilder
;
typedef
struct
SRowBatchIter
SRowBatchIter
;
typedef
struct
SRowBatchBuilder
SRowBatchBuilder
;
// 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))
static
FORCE_INLINE
SRow
rowDup
(
SRow
row
)
{
SRow
r
=
malloc
(
rowLen
(
row
));
if
(
r
==
NULL
)
{
return
NULL
;
}
rowCopy
(
r
,
row
);
return
r
;
}
// SRowBatch
// SRowBuilder
SRowBuilder
*
rowBuilderCreate
();
void
rowBuilderDestroy
(
SRowBuilder
*
);
// SRowBatchIter
SRowBatchIter
*
rowBatchIterCreate
(
SRowBatch
*
);
void
rowBatchIterDestroy
(
SRowBatchIter
*
);
const
SRow
rowBatchIterNext
(
SRowBatchIter
*
);
#define rowType(r)
#define rowLen(r)
#define rowVersion(r)
#define rowNCols(r)
// SRowBatchBuilder
SRowBatchBuilder
*
rowBatchBuilderCreate
();
void
rowBatchBuilderDestroy
(
SRowBatchBuilder
*
);
#ifdef __cplusplus
}
...
...
source/common/src/trow.c
浏览文件 @
bab6e54b
...
...
@@ -11,4 +11,79 @@
*
* 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 "trow.h"
/* ------------ Structures ---------- */
struct
SRowBatch
{
int32_t
compress
:
1
;
// if batch row is compressed
int32_t
nrows
:
31
;
// number of rows
int32_t
tlen
;
// total length (including `nrows` and `tlen`)
char
rows
[];
};
struct
SRowBuilder
{
// TODO
};
struct
SRowBatchIter
{
int32_t
counter
;
// row counter
SRowBatch
*
rb
;
// row batch to iter
SRow
nrow
;
// next row
};
struct
SRowBatchBuilder
{
// TODO
};
/* ------------ Methods ---------- */
// SRowBuilder
SRowBuilder
*
rowBuilderCreate
()
{
SRowBuilder
*
pRowBuilder
=
NULL
;
// TODO
return
pRowBuilder
;
}
void
rowBuilderDestroy
(
SRowBuilder
*
pRowBuilder
)
{
if
(
pRowBuilder
)
{
free
(
pRowBuilder
);
}
}
// SRowBatchIter
SRowBatchIter
*
rowBatchIterCreate
(
SRowBatch
*
pRowBatch
)
{
SRowBatchIter
*
pRowBatchIter
=
(
SRowBatchIter
*
)
malloc
(
sizeof
(
*
pRowBatchIter
));
if
(
pRowBatchIter
==
NULL
)
{
return
NULL
;
}
pRowBatchIter
->
counter
=
0
;
pRowBatchIter
->
rb
=
pRowBatch
;
pRowBatchIter
->
nrow
=
pRowBatch
->
rows
;
return
pRowBatchIter
;
};
void
rowBatchIterDestroy
(
SRowBatchIter
*
pRowBatchIter
)
{
if
(
pRowBatchIter
)
{
free
(
pRowBatchIter
);
}
}
const
SRow
rowBatchIterNext
(
SRowBatchIter
*
pRowBatchIter
)
{
SRow
r
=
NULL
;
if
(
pRowBatchIter
->
counter
<
pRowBatchIter
->
rb
->
nrows
)
{
r
=
pRowBatchIter
->
nrow
;
pRowBatchIter
->
counter
+=
1
;
pRowBatchIter
->
nrow
=
(
SRow
)
POINTER_SHIFT
(
r
,
rowLen
(
r
));
}
return
r
;
}
// SRowBatchBuilder
SRowBatchBuilder
*
rowBatchBuilderCreate
();
void
rowBatchBuilderDestroy
(
SRowBatchBuilder
*
);
\ No newline at end of file
source/server/vnode/meta/test/metaTests.cpp
浏览文件 @
bab6e54b
...
...
@@ -4,5 +4,6 @@
#include "meta.h"
TEST
(
MetaTest
,
meta_open_test
)
{
metaOpen
(
NULL
);
std
::
cout
<<
"Hello META!"
<<
std
::
endl
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录