Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3989a061
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看板
提交
3989a061
编写于
2月 09, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more TDB
上级
123dc0cd
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
59 addition
and
12 deletion
+59
-12
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-1
source/libs/tdb/inc/tdb.h
source/libs/tdb/inc/tdb.h
+7
-2
source/libs/tdb/src/db/pgfile.c
source/libs/tdb/src/db/pgfile.c
+1
-1
source/libs/tdb/src/db/tdb.c
source/libs/tdb/src/db/tdb.c
+28
-6
source/libs/tdb/src/db/tdbEnv.c
source/libs/tdb/src/db/tdbEnv.c
+18
-1
source/libs/tdb/src/inc/pgfile.h
source/libs/tdb/src/inc/pgfile.h
+1
-1
source/libs/tdb/src/inc/tdbEnv.h
source/libs/tdb/src/inc/tdbEnv.h
+3
-0
未找到文件。
source/dnode/vnode/CMakeLists.txt
浏览文件 @
3989a061
set
(
META_DB_IMPL_LIST
"BDB"
"TDB"
)
set
(
META_DB_IMPL
"
B
DB"
CACHE STRING
"Use BDB as the default META implementation"
)
set
(
META_DB_IMPL
"
T
DB"
CACHE STRING
"Use BDB as the default META implementation"
)
set_property
(
CACHE META_DB_IMPL PROPERTY STRINGS
${
META_DB_IMPL_LIST
}
)
if
(
META_DB_IMPL IN_LIST META_DB_IMPL_LIST
)
...
...
source/libs/tdb/inc/tdb.h
浏览文件 @
3989a061
...
...
@@ -22,16 +22,21 @@
extern
"C"
{
#endif
typedef
struct
STDb
TDB
;
typedef
struct
STDbEnv
TENV
;
typedef
struct
STDb
TDB
;
typedef
struct
STDbEnv
TENV
;
typedef
struct
STDbCurosr
TDBC
;
// TEVN
int
tdbEnvOpen
(
TENV
**
ppEnv
);
int
tdbEnvClose
(
TENV
*
pEnv
);
// TDB
int
tdbCreate
(
TDB
**
ppDb
);
int
tdbOpen
(
TDB
**
ppDb
,
const
char
*
fname
,
const
char
*
dbname
,
TENV
*
pEnv
);
int
tdbClose
(
TDB
*
pDb
);
// TDBC
#ifdef __cplusplus
}
#endif
...
...
source/libs/tdb/src/db/pgfile.c
浏览文件 @
3989a061
...
...
@@ -17,7 +17,7 @@
static
int
pgFileRead
(
SPgFile
*
pPgFile
,
pgno_t
pgno
,
uint8_t
*
pData
);
int
pgFileOpen
(
const
char
*
fname
,
SPgCache
*
pPgCache
,
SPgFile
**
ppPgFil
e
)
{
int
pgFileOpen
(
SPgFile
**
ppPgFile
,
const
char
*
fname
,
SPgCache
*
pPgCach
e
)
{
SPgFile
*
pPgFile
;
*
ppPgFile
=
NULL
;
...
...
source/libs/tdb/src/db/tdb.c
浏览文件 @
3989a061
...
...
@@ -42,8 +42,11 @@ static int tdbDestroy(TDB *pDb) {
}
int
tdbOpen
(
TDB
**
ppDb
,
const
char
*
fname
,
const
char
*
dbname
,
TENV
*
pEnv
)
{
TDB
*
pDb
;
int
ret
;
TDB
*
pDb
;
int
ret
;
uint8_t
fileid
[
TDB_FILE_ID_LEN
];
SPgFile
*
pPgFile
;
SPgCache
*
pPgCache
;
// Create DB if DB handle is not created yet
if
(
ppDb
==
NULL
)
{
...
...
@@ -56,12 +59,31 @@ int tdbOpen(TDB **ppDb, const char *fname, const char *dbname, TENV *pEnv) {
// Create a default ENV if pEnv is not set
if
(
pEnv
==
NULL
)
{
// if ((ret = te
nvOpen(&pEnv)) != 0) {
//
return -1;
//
}
if
((
ret
=
tdbE
nvOpen
(
&
pEnv
))
!=
0
)
{
return
-
1
;
}
}
/* TODO */
pDb
->
pEnv
=
pEnv
;
// register DB to ENV
ASSERT
(
fname
!=
NULL
);
// Check if file exists (TODO)
// Check if the SPgFile already opened
pPgFile
=
tdbEnvGetPageFile
(
pEnv
,
fileid
);
if
(
pPgFile
==
NULL
)
{
pPgCache
=
tdbEnvGetPgCache
(
pEnv
);
if
((
ret
=
pgFileOpen
(
&
pPgFile
,
fname
,
pPgCache
))
!=
0
)
{
return
-
1
;
}
}
pDb
->
pPgFile
=
pPgFile
;
// open the access method (TODO)
return
0
;
}
...
...
source/libs/tdb/src/db/tdbEnv.c
浏览文件 @
3989a061
...
...
@@ -21,4 +21,21 @@ struct STDbEnv {
struct
{
}
pgfht
;
// page file hash table;
SPgCache
pgc
;
// page cache
};
\ No newline at end of file
};
int
tdbEnvOpen
(
TENV
**
ppEnv
)
{
// TODO
return
0
;
}
int
tdbEnvClose
(
TENV
*
pEnv
)
{
// TODO
return
0
;
}
SPgFile
*
tdbEnvGetPageFile
(
TENV
*
pEnv
,
const
uint8_t
fileid
[])
{
// TODO
return
NULL
;
}
SPgCache
*
tdbEnvGetPgCache
(
TENV
*
pEnv
)
{
return
&
(
pEnv
->
pgc
);
}
\ No newline at end of file
source/libs/tdb/src/inc/pgfile.h
浏览文件 @
3989a061
...
...
@@ -30,7 +30,7 @@ struct SPgFile {
pgno_t
pgFileSize
;
};
int
pgFileOpen
(
const
char
*
fname
,
SPgCache
*
pPgCache
,
SPgFile
**
ppPgFil
e
);
int
pgFileOpen
(
SPgFile
**
ppPgFile
,
const
char
*
fname
,
SPgCache
*
pPgCach
e
);
int
pgFileClose
(
SPgFile
*
pPgFile
);
SPage
*
pgFileFetch
(
SPgFile
*
pPgFile
,
pgno_t
pgno
);
...
...
source/libs/tdb/src/inc/tdbEnv.h
浏览文件 @
3989a061
...
...
@@ -20,6 +20,9 @@
extern
"C"
{
#endif
SPgFile
*
tdbEnvGetPageFile
(
TENV
*
pEnv
,
const
uint8_t
fileid
[]);
SPgCache
*
tdbEnvGetPgCache
(
TENV
*
pEnv
);
#ifdef __cplusplus
}
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录