Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cefc6930
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看板
提交
cefc6930
编写于
3月 28, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/tdb' of
https://github.com/taosdata/TDengine
into feature/meta
上级
417703c9
0a602259
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
44 deletion
+31
-44
source/libs/tdb/src/db/tdbDb.c
source/libs/tdb/src/db/tdbDb.c
+13
-13
source/libs/tdb/src/inc/tdbDb.h
source/libs/tdb/src/inc/tdbDb.h
+12
-12
source/libs/tdb/src/inc/tdbInt.h
source/libs/tdb/src/inc/tdbInt.h
+0
-13
source/libs/tdb/test/tdbTest.cpp
source/libs/tdb/test/tdbTest.cpp
+6
-6
未找到文件。
source/libs/tdb/src/db/tdbDb.c
浏览文件 @
cefc6930
...
...
@@ -24,8 +24,8 @@ struct STDBC {
SBTC
btc
;
};
int
tdbDbOpen
(
const
char
*
fname
,
int
keyLen
,
int
valLen
,
FKeyComparator
keyCmprFn
,
STEnv
*
pEnv
,
S
TDB
**
ppDb
)
{
STDB
*
pDb
;
int
tdbDbOpen
(
const
char
*
fname
,
int
keyLen
,
int
valLen
,
FKeyComparator
keyCmprFn
,
STEnv
*
pEnv
,
TDB
**
ppDb
)
{
TDB
*
pDb
;
SPager
*
pPager
;
int
ret
;
char
fFullName
[
TDB_FILENAME_LEN
];
...
...
@@ -34,7 +34,7 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF
*
ppDb
=
NULL
;
pDb
=
(
S
TDB
*
)
tdbOsCalloc
(
1
,
sizeof
(
*
pDb
));
pDb
=
(
TDB
*
)
tdbOsCalloc
(
1
,
sizeof
(
*
pDb
));
if
(
pDb
==
NULL
)
{
return
-
1
;
}
...
...
@@ -63,17 +63,17 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF
return
0
;
}
int
tdbDbClose
(
S
TDB
*
pDb
)
{
int
tdbDbClose
(
TDB
*
pDb
)
{
// TODO
return
0
;
}
int
tdbDbDrop
(
S
TDB
*
pDb
)
{
int
tdbDbDrop
(
TDB
*
pDb
)
{
// TODO
return
0
;
}
int
tdbDbInsert
(
S
TDB
*
pDb
,
const
void
*
pKey
,
int
keyLen
,
const
void
*
pVal
,
int
valLen
)
{
int
tdbDbInsert
(
TDB
*
pDb
,
const
void
*
pKey
,
int
keyLen
,
const
void
*
pVal
,
int
valLen
)
{
SBTC
btc
;
SBTC
*
pCur
;
int
ret
;
...
...
@@ -92,16 +92,16 @@ int tdbDbInsert(STDB *pDb, const void *pKey, int keyLen, const void *pVal, int v
return
0
;
}
int
tdbDbGet
(
S
TDB
*
pDb
,
const
void
*
pKey
,
int
kLen
,
void
**
ppVal
,
int
*
vLen
)
{
int
tdbDbGet
(
TDB
*
pDb
,
const
void
*
pKey
,
int
kLen
,
void
**
ppVal
,
int
*
vLen
)
{
return
tdbBtreeGet
(
pDb
->
pBt
,
pKey
,
kLen
,
ppVal
,
vLen
);
}
int
tdbDbcOpen
(
STDB
*
pDb
,
S
TDBC
**
ppDbc
)
{
int
ret
;
S
TDBC
*
pDbc
=
NULL
;
int
tdbDbcOpen
(
TDB
*
pDb
,
TDBC
**
ppDbc
)
{
int
ret
;
TDBC
*
pDbc
=
NULL
;
*
ppDbc
=
NULL
;
pDbc
=
(
S
TDBC
*
)
tdbOsMalloc
(
sizeof
(
*
pDbc
));
pDbc
=
(
TDBC
*
)
tdbOsMalloc
(
sizeof
(
*
pDbc
));
if
(
pDbc
==
NULL
)
{
return
-
1
;
}
...
...
@@ -120,11 +120,11 @@ int tdbDbcOpen(STDB *pDb, STDBC **ppDbc) {
return
0
;
}
int
tdbDbNext
(
S
TDBC
*
pDbc
,
void
**
ppKey
,
int
*
kLen
,
void
**
ppVal
,
int
*
vLen
)
{
int
tdbDbNext
(
TDBC
*
pDbc
,
void
**
ppKey
,
int
*
kLen
,
void
**
ppVal
,
int
*
vLen
)
{
return
tdbBtreeNext
(
&
pDbc
->
btc
,
ppKey
,
kLen
,
ppVal
,
vLen
);
}
int
tdbDbcClose
(
S
TDBC
*
pDbc
)
{
int
tdbDbcClose
(
TDBC
*
pDbc
)
{
if
(
pDbc
)
{
tdbOsFree
(
pDbc
);
}
...
...
source/libs/tdb/src/inc/tdbDb.h
浏览文件 @
cefc6930
...
...
@@ -20,20 +20,20 @@
extern
"C"
{
#endif
typedef
struct
STDB
S
TDB
;
typedef
struct
STDBC
S
TDBC
;
typedef
struct
STDB
TDB
;
typedef
struct
STDBC
TDBC
;
//
S
TDB
int
tdbDbOpen
(
const
char
*
fname
,
int
keyLen
,
int
valLen
,
FKeyComparator
keyCmprFn
,
STEnv
*
pEnv
,
S
TDB
**
ppDb
);
int
tdbDbClose
(
S
TDB
*
pDb
);
int
tdbDbDrop
(
S
TDB
*
pDb
);
int
tdbDbInsert
(
S
TDB
*
pDb
,
const
void
*
pKey
,
int
keyLen
,
const
void
*
pVal
,
int
valLen
);
int
tdbDbGet
(
S
TDB
*
pDb
,
const
void
*
pKey
,
int
kLen
,
void
**
ppVal
,
int
*
vLen
);
// TDB
int
tdbDbOpen
(
const
char
*
fname
,
int
keyLen
,
int
valLen
,
FKeyComparator
keyCmprFn
,
STEnv
*
pEnv
,
TDB
**
ppDb
);
int
tdbDbClose
(
TDB
*
pDb
);
int
tdbDbDrop
(
TDB
*
pDb
);
int
tdbDbInsert
(
TDB
*
pDb
,
const
void
*
pKey
,
int
keyLen
,
const
void
*
pVal
,
int
valLen
);
int
tdbDbGet
(
TDB
*
pDb
,
const
void
*
pKey
,
int
kLen
,
void
**
ppVal
,
int
*
vLen
);
//
S
TDBC
int
tdbDbcOpen
(
STDB
*
pDb
,
S
TDBC
**
ppDbc
);
int
tdbDbNext
(
S
TDBC
*
pDbc
,
void
**
ppKey
,
int
*
kLen
,
void
**
ppVal
,
int
*
vLen
);
int
tdbDbcClose
(
S
TDBC
*
pDbc
);
// TDBC
int
tdbDbcOpen
(
TDB
*
pDb
,
TDBC
**
ppDbc
);
int
tdbDbNext
(
TDBC
*
pDbc
,
void
**
ppKey
,
int
*
kLen
,
void
**
ppVal
,
int
*
vLen
);
int
tdbDbcClose
(
TDBC
*
pDbc
);
#ifdef __cplusplus
}
...
...
source/libs/tdb/src/inc/tdbInt.h
浏览文件 @
cefc6930
...
...
@@ -116,19 +116,6 @@ typedef TD_DLIST_NODE(SPgFile) SPgFileListNode;
#define TDB_VARIANT_LEN ((int)-1)
// page payload format
// <keyLen> + <valLen> + [key] + [value]
#define TDB_DECODE_PAYLOAD(pPayload, keyLen, pKey, valLen, pVal) \
do { \
if ((keyLen) == TDB_VARIANT_LEN) { \
/* TODO: decode the keyLen */
\
} \
if ((valLen) == TDB_VARIANT_LEN) { \
/* TODO: decode the valLen */
\
} \
/* TODO */
\
} while (0)
typedef
int
(
*
FKeyComparator
)(
const
void
*
pKey1
,
int
kLen1
,
const
void
*
pKey2
,
int
kLen2
);
#define TDB_JOURNAL_NAME "tdb.journal"
...
...
source/libs/tdb/test/tdbTest.cpp
浏览文件 @
cefc6930
...
...
@@ -116,7 +116,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in
TEST
(
tdb_test
,
simple_test
)
{
int
ret
;
STEnv
*
pEnv
;
STDB
*
pDb
;
TDB
*
pDb
;
FKeyComparator
compFunc
;
int
nData
=
1000000
;
...
...
@@ -183,11 +183,11 @@ TEST(tdb_test, simple_test) {
}
{
// Iterate to query the DB data
S
TDBC
*
pDBC
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
,
kLen
;
int
count
=
0
;
TDBC
*
pDBC
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
,
kLen
;
int
count
=
0
;
ret
=
tdbDbcOpen
(
pDb
,
&
pDBC
);
GTEST_ASSERT_EQ
(
ret
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录