Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
0c1a9706
T
TDengine
项目概览
小楼昨夜-听风雨
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c1a9706
编写于
2月 18, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
83edc110
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
118 addition
and
2 deletion
+118
-2
src/vnode/CMakeLists.txt
src/vnode/CMakeLists.txt
+5
-1
src/vnode/common/inc/dataformat.h
src/vnode/common/inc/dataformat.h
+5
-0
src/vnode/common/src/dataformat.c
src/vnode/common/src/dataformat.c
+29
-0
src/vnode/tests/CMakeLists.txt
src/vnode/tests/CMakeLists.txt
+3
-0
src/vnode/tests/common/CMakeLists.txt
src/vnode/tests/common/CMakeLists.txt
+14
-0
src/vnode/tests/common/commonDataTests.cpp
src/vnode/tests/common/commonDataTests.cpp
+7
-0
src/vnode/tests/common/commonSChemaTests.cpp
src/vnode/tests/common/commonSChemaTests.cpp
+9
-0
src/vnode/tests/tsdb/CMakeLists.txt
src/vnode/tests/tsdb/CMakeLists.txt
+13
-0
src/vnode/tests/tsdb/tsdbTests.cpp
src/vnode/tests/tsdb/tsdbTests.cpp
+15
-0
src/vnode/tsdb/inc/tsdbCache.h
src/vnode/tsdb/inc/tsdbCache.h
+1
-1
src/vnode/tsdb/src/tsdb.c
src/vnode/tsdb/src/tsdb.c
+17
-0
未找到文件。
src/vnode/CMakeLists.txt
浏览文件 @
0c1a9706
...
...
@@ -4,4 +4,8 @@ project(tsdb)
add_subdirectory
(
common
)
add_subdirectory
(
tsdb
)
\ No newline at end of file
add_subdirectory
(
tsdb
)
enable_testing
()
add_subdirectory
(
tests
)
\ No newline at end of file
src/vnode/common/inc/dataformat.h
浏览文件 @
0c1a9706
...
...
@@ -46,6 +46,7 @@ typedef char * SDataCols;
// ----------------- Data column structure
// ---- operation on SDataRow;
#define TD_DATA_ROW_HEADER_SIZE sizeof(int32_t)
#define TD_DATAROW_LEN(pDataRow) (*(int32_t *)(pDataRow))
#define TD_DATAROW_DATA(pDataRow) ((pDataRow) + sizeof(int32_t))
...
...
@@ -63,5 +64,9 @@ typedef char * SDataCols;
#define TD_DATACOLS_NPOINTS(pDataCols) (*(int32_t *)(pDataCols + sizeof(int32_t)))
// ----
/**
* Get the maximum
*/
int32_t
tdGetMaxDataRowSize
(
SSchema
*
pSchema
);
#endif // _TD_DATA_FORMAT_H_
src/vnode/common/src/dataformat.c
浏览文件 @
0c1a9706
#include <stdlib.h>
#include "dataformat.h"
int32_t
tdGetMaxDataRowSize
(
SSchema
*
pSchema
)
{
int32_t
nbytes
=
0
;
for
(
int32_t
i
=
0
;
i
<
TD_SCHEMA_NCOLS
(
pSchema
);
i
++
)
{
SColumn
*
pCol
=
TD_SCHEMA_COLUMN_AT
(
pSchema
,
i
);
td_datatype_t
type
=
TD_COLUMN_TYPE
(
pCol
);
nbytes
+=
rowDataLen
[
type
];
switch
(
type
)
{
case
TD_DATATYPE_VARCHAR
:
nbytes
+=
TD_COLUMN_BYTES
(
pCol
);
break
;
case
TD_DATATYPE_NCHAR
:
nbytes
+=
4
*
TD_COLUMN_BYTES
(
pCol
);
break
;
case
TD_DATATYPE_BINARY
:
nbytes
+=
TD_COLUMN_BYTES
(
pCol
);
break
;
}
}
nbytes
+=
TD_DATA_ROW_HEADER_SIZE
;
return
nbytes
;
}
\ No newline at end of file
src/vnode/tests/CMakeLists.txt
0 → 100644
浏览文件 @
0c1a9706
add_subdirectory
(
common
)
add_subdirectory
(
tsdb
)
\ No newline at end of file
src/vnode/tests/common/CMakeLists.txt
0 → 100644
浏览文件 @
0c1a9706
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
message
(
STATUS
"COMMON:
${
SOURCE_LIST
}
"
)
add_executable
(
commonTests
${
SOURCE_LIST
}
)
target_link_libraries
(
commonTests gtest gtest_main pthread common
)
add_test
(
NAME
unit
COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/commonTests
)
\ No newline at end of file
src/vnode/tests/common/commonDataTests.cpp
0 → 100644
浏览文件 @
0c1a9706
#include <gtest/gtest.h>
#include "dataformat.h"
TEST
(
commonDataTests
,
createDataRow
)
{
EXPECT_EQ
(
1
,
2
/
2
);
}
\ No newline at end of file
src/vnode/tests/common/commonSChemaTests.cpp
0 → 100644
浏览文件 @
0c1a9706
#include <gtest/gtest.h>
#include <stdlib.h>
#include <stdio.h>
#include "schema.h"
TEST
(
commonSchemaTests
,
createSchema
)
{
EXPECT_EQ
(
1
,
2
/
2
);
}
\ No newline at end of file
src/vnode/tests/tsdb/CMakeLists.txt
0 → 100644
浏览文件 @
0c1a9706
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
message
(
STATUS
"TSDB:
${
SOURCE_LIST
}
"
)
add_executable
(
tsdbTests
${
SOURCE_LIST
}
)
target_link_libraries
(
tsdbTests gtest gtest_main pthread tsdb
)
add_test
(
NAME
unit
COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/tsdbTests
)
\ No newline at end of file
src/vnode/tests/tsdb/tsdbTests.cpp
0 → 100644
浏览文件 @
0c1a9706
#include <gtest/gtest.h>
#include <stdlib.h>
#include "tsdb.h"
TEST
(
TsdbTest
,
createTsdbRepo
)
{
STSDBCfg
*
pCfg
=
(
STSDBCfg
*
)
malloc
(
sizeof
(
STSDBCfg
));
pCfg
->
rootDir
=
"/var/lib/taos/"
;
int32_t
err_num
=
0
;
tsdb_repo_t
*
pRepo
=
tsdbCreateRepo
(
pCfg
,
&
err_num
);
ASSERT_EQ
(
pRepo
,
NULL
);
}
\ No newline at end of file
src/vnode/tsdb/inc/tsdbCache.h
浏览文件 @
0c1a9706
...
...
@@ -10,7 +10,7 @@
typedef
struct
{
int64_t
skey
;
// start key
int64_t
ekey
;
// end key
int32_t
numOfRows
// numOfRows
int32_t
numOfRows
;
// numOfRows
}
STableCacheInfo
;
typedef
struct
_tsdb_cache_block
{
...
...
src/vnode/tsdb/src/tsdb.c
浏览文件 @
0c1a9706
#include <pthread.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
// #include "taosdef.h"
// #include "disk.h"
#include "tsdbFile.h"
#include "tsdb.h"
#include "tsdbCache.h"
#include "tsdbMeta.h"
...
...
@@ -33,6 +38,11 @@ typedef struct STSDBRepo {
// Check the correctness of the TSDB configuration
static
int32_t
tsdbCheckCfg
(
STSDBCfg
*
pCfg
)
{
if
(
pCfg
->
rootDir
==
NULL
)
return
-
1
;
if
(
access
(
pCfg
->
rootDir
,
F_OK
|
R_OK
|
W_OK
)
==
-
1
)
{
return
-
1
;
}
// TODO
return
0
;
}
...
...
@@ -42,6 +52,7 @@ tsdb_repo_t *tsdbCreateRepo(STSDBCfg *pCfg, int32_t *error) {
err
=
tsdbCheckCfg
(
pCfg
);
if
(
err
!=
0
)
{
// TODO: deal with the error here
return
NULL
;
}
STSDBRepo
*
pRepo
=
(
STSDBRepo
*
)
malloc
(
sizeof
(
STSDBRepo
));
...
...
@@ -65,6 +76,12 @@ tsdb_repo_t *tsdbCreateRepo(STSDBCfg *pCfg, int32_t *error) {
return
NULL
;
}
// Create the Meta data file and data directory
char
*
pTsdbMetaFName
=
tsdbGetFileName
(
pCfg
->
rootDir
,
"tsdb"
,
TSDB_FILE_TYPE_META
);
// int fd = open(pTsdbMetaFName, )
// if (open)
return
(
tsdb_repo_t
*
)
pRepo
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录