Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1e84bce8
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看板
提交
1e84bce8
编写于
1月 18, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more tkv
上级
7a57f0c7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
74 addition
and
16 deletion
+74
-16
source/libs/tdb/inc/tdb.h
source/libs/tdb/inc/tdb.h
+14
-0
source/libs/tdb/src/inc/tdbDB.h
source/libs/tdb/src/inc/tdbDB.h
+0
-4
source/libs/tdb/src/inc/tdbDef.h
source/libs/tdb/src/inc/tdbDef.h
+1
-0
source/libs/tdb/src/inc/tdb_mpfile.h
source/libs/tdb/src/inc/tdb_mpfile.h
+10
-12
source/libs/tdb/src/inc/tdb_mpool.h
source/libs/tdb/src/inc/tdb_mpool.h
+35
-0
source/libs/tdb/src/mpool/tdb_mpool.c
source/libs/tdb/src/mpool/tdb_mpool.c
+14
-0
未找到文件。
source/libs/tdb/inc/tdb.h
浏览文件 @
1e84bce8
...
...
@@ -30,6 +30,8 @@ typedef enum { TDB_BTREE_T = 0, TDB_HASH_T = 1, TDB_HEAP_T = 2 } tdb_db_t;
// Forward declarations
typedef
struct
TDB
TDB
;
typedef
struct
TDB_MPOOL
TDB_MPOOL
;
typedef
struct
TDB_MPFILE
TDB_MPFILE
;
typedef
struct
TDB_CURSOR
TDB_CURSOR
;
typedef
struct
{
...
...
@@ -44,6 +46,18 @@ int tdbCloseDB(TDB* dbp, uint32_t flags);
int
tdbPut
(
TDB
*
dbp
,
const
TDB_KEY
*
key
,
const
TDB_VALUE
*
value
,
uint32_t
flags
);
int
tdbGet
(
TDB
*
dbp
,
const
TDB_KEY
*
key
,
TDB_VALUE
*
value
,
uint32_t
flags
);
// TDB_MPOOL
int
tdbOpenMPool
(
TDB_MPOOL
**
mp
);
int
tdbCloseMPool
(
TDB_MPOOL
*
mp
);
// TDB_MPFILE
int
tdbOpenMPFile
(
TDB_MPFILE
**
mpf
,
TDB_MPOOL
*
mp
);
int
tdbCloseMPFile
(
TDB_MPFILE
**
mpf
);
// TDB_CURSOR
int
tdbOpenCursor
(
TDB
*
dbp
,
TDB_CURSOR
**
tdbcpp
);
int
tdbCloseCurosr
(
TDB_CURSOR
*
tdbcp
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/tdb/src/inc/tdbDB.h
浏览文件 @
1e84bce8
...
...
@@ -25,10 +25,6 @@
extern
"C"
{
#endif
typedef
struct
{
// TODO
}
TDB_MPOOL
;
typedef
struct
{
int
fd
;
}
TDB_FH
;
...
...
source/libs/tdb/src/inc/tdbDef.h
浏览文件 @
1e84bce8
...
...
@@ -17,6 +17,7 @@
#define _TD_TDB_DEF_H_
#include "os.h"
#include "tlist.h"
#ifdef __cplusplus
extern
"C"
{
...
...
source/libs/tdb/src/inc/tdb
BufPool
.h
→
source/libs/tdb/src/inc/tdb
_mpfile
.h
浏览文件 @
1e84bce8
...
...
@@ -13,27 +13,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_TDB_
BUF_POOL
_H_
#define _TD_TDB_
BUF_POOL
_H_
#ifndef _TD_TDB_
MPFILE
_H_
#define _TD_TDB_
MPFILE
_H_
#include "tdbPage.h"
#include "tdbDef.h"
#include "tdb_mpool.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
STdbBufPool
STdbBufPool
;
struct
TDB_MPFILE
{
TDB_MPOOL
*
mp
;
// memory pool used to get/put pages in this file
int
tbpOpen
(
STdbBufPool
**
ppTkvBufPool
);
int
tbpClose
(
STdbBufPool
*
pTkvBufPool
);
STdbPage
*
tbpNewPage
(
STdbBufPool
*
pTkvBufPool
);
int
tbpDelPage
(
STdbBufPool
*
pTkvBufPool
);
STdbPage
*
tbpFetchPage
(
STdbBufPool
*
pTkvBufPool
,
pgid_t
pgid
);
int
tbpUnpinPage
(
STdbBufPool
*
pTkvBufPool
,
pgid_t
pgid
);
void
tbpFlushPages
(
STdbBufPool
*
pTkvBufPool
);
char
*
fname
;
int
fd
;
};
#ifdef __cplusplus
}
#endif
#endif
/*_TD_TDB_BUF_POOL_H_*/
\ No newline at end of file
#endif
/*_TD_TDB_MPFILE_H_*/
\ No newline at end of file
source/libs/tdb/src/
mpool/tdbBufPool.c
→
source/libs/tdb/src/
inc/tdb_mpool.h
浏览文件 @
1e84bce8
...
...
@@ -13,42 +13,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#i
nclude "thash.h"
#
include "tlist.h"
#i
fndef _TD_TDB_MPOOL_H_
#
define _TD_TDB_MPOOL_H_
#include "tdbBufPool.h"
#include "tdbDiskMgr.h"
#include "tdbPage.h"
#include "tdbDef.h"
struct
SFrameIdWrapper
{
TD_SLIST_NODE
(
SFrameIdWrapper
);
frame_id_t
id
;
};
#ifdef __cplusplus
extern
"C"
{
#endif
struct
STdbBufPool
{
STdbPage
*
pages
;
STkvDiskMgr
*
pDiskMgr
;
SHashObj
*
pgTb
;
// page_id_t --> frame_id_t
TD_SLIST
(
SFrameIdWrapper
)
freeList
;
struct
TDB_MPOOL
{
pthread_mutex_t
mutex
;
int64_t
cachesize
;
pgsize_t
pgsize
;
};
typedef
struct
STkvLRUReplacer
{
}
STkvLRUReplacer
;
typedef
struct
STkvLFUReplacer
{
}
STkvLFUReplacer
;
typedef
struct
STkvCLKReplacer
{
}
STkvCLKReplacer
;
typedef
enum
{
TKV_LRU_REPLACER
=
0
,
TKV_LFU_REPLACER
,
TVK_CLK_REPLACER
}
tkv_replacer_t
;
#ifdef __cplusplus
}
#endif
typedef
struct
STkvReplacer
{
tkv_replacer_t
type
;
union
{
STkvLRUReplacer
lruRep
;
STkvLFUReplacer
lfuRep
;
STkvCLKReplacer
clkRep
;
};
}
STkvReplacer
;
\ No newline at end of file
#endif
/*_TD_TDB_MPOOL_H_*/
\ No newline at end of file
source/libs/tdb/src/mpool/tdb_mpool.c
0 → 100644
浏览文件 @
1e84bce8
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* 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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录