Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d89aae08
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看板
提交
d89aae08
编写于
10月 08, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
4e306a79
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
104 addition
and
78 deletion
+104
-78
include/libs/tkv/tkv.h
include/libs/tkv/tkv.h
+19
-46
include/server/vnode/meta/meta.h
include/server/vnode/meta/meta.h
+31
-5
include/server/vnode/tsdb/tsdb.h
include/server/vnode/tsdb/tsdb.h
+54
-27
未找到文件。
include/libs/tkv/tkv.h
浏览文件 @
d89aae08
...
...
@@ -20,52 +20,25 @@
extern
"C"
{
#endif
typedef
struct
tkv_db_s
tkv_db_t
;
typedef
struct
{
/* data */
}
tkv_key_t
;
typedef
struct
{
bool
pinned
;
int64_t
ref
;
// TODO: use util library
// TODO: add a RW latch here
uint64_t
offset
;
void
*
pObj
;
}
tkv_obj_t
;
typedef
int
(
*
tkv_key_comp_fn_t
)(
const
tkv_key_t
*
,
const
tkv_key_t
*
);
typedef
void
(
*
tkv_get_key_fn_t
)(
const
tkv_obj_t
*
,
tkv_key_t
*
);
typedef
int
(
*
tkv_obj_encode_fn_t
)(
void
**
buf
,
void
*
pObj
);
typedef
void
*
(
*
tkv_obj_decode_fn_t
)(
void
*
buf
,
void
**
pObj
);
typedef
int
(
*
tkv_obj_comp_fn_t
)(
const
tkv_obj_t
*
,
const
tkv_obj_t
*
);
typedef
void
(
*
tkv_obj_destroy_fn_t
)(
void
*
);
typedef
struct
{
uint64_t
memLimit
;
tkv_get_key_fn_t
getKey
;
tkv_obj_encode_fn_t
encode
;
tkv_obj_decode_fn_t
decode
;
tkv_obj_comp_fn_t
compare
;
tkv_obj_destroy_fn_t
destroy
;
}
tkv_db_option_t
;
tkv_db_t
*
tkvOpenDB
(
char
*
dir
,
tkv_db_option_t
*
);
int
tkvCloseDB
(
tkv_db_t
*
);
int
tkvPut
(
tkv_db_t
*
,
tkv_obj_t
*
);
int
tkvPutBatch
(
tkv_db_t
*
,
tkv_obj_t
**
,
int
);
// TODO: use array here
const
tkv_obj_t
*
tkvGet
(
tkv_key_t
*
);
int
tkvGetBatch
(
tkv_db_t
*
,
tkv_key_t
**
,
int
,
tkv_obj_t
**
);
// TODO: use array here
int
tkvDrop
(
tkv_db_t
*
,
tkv_key_t
*
);
int
tkvDropBatch
(
tkv_db_t
*
,
tkv_key_t
**
,
int
);
// TODO: use array here
int
tkvCommit
(
tkv_db_t
*
,
void
*
/*TODO*/
);
typedef
struct
{
}
tkv_db_iter_t
;
tkv_db_iter_t
*
tkvIterNew
(
tkv_db_t
*
);
void
tkvIterFree
(
tkv_db_iter_t
*
);
const
tkv_obj_t
*
tkvIterNext
(
tkv_db_iter_t
*
);
// Types exported
typedef
struct
STkvDb
STkvDb
;
typedef
struct
STkvOptions
STkvOptions
;
typedef
struct
STkvCache
STkvCache
;
// DB operations
STkvDb
*
tkvOpen
(
const
STkvOptions
*
options
,
const
char
*
path
);
void
tkvClose
(
STkvDb
*
db
);
void
tkvPut
(
STkvDb
*
db
,
void
*
/*TODO*/
);
// DB options
STkvOptions
*
tkvOptionsCreate
();
void
tkvOptionsDestroy
(
STkvOptions
*
);
void
tkvOptionsSetCache
(
STkvOptions
*
,
STkvCache
*
);
// DB cache
typedef
enum
{
TKV_LRU_CACHE
=
0
,
TKV_LFU_CACHE
=
1
}
ETkvCacheType
;
STkvCache
*
tkvCacheCreate
(
size_t
capacity
,
ETkvCacheType
type
);
void
tkvCacheDestroy
(
STkvCache
*
);
#ifdef __cplusplus
}
...
...
include/server/vnode/meta/meta.h
浏览文件 @
d89aae08
...
...
@@ -18,16 +18,42 @@
#include "taosMsg.h"
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
SMeta
SMeta
;
typedef
uint64_t
tuid_t
;
// Types exported
typedef
struct
SMeta
SMeta
;
typedef
struct
SMetaOptions
SMetaOptions
;
typedef
struct
SMetaQueryHandle
SMetaQueryHandle
;
typedef
struct
SMetaQueryOptions
SMetaQueryOptions
;
// SMeta operations
int
metaCreate
(
const
char
*
path
);
int
metaDestroy
(
const
char
*
path
);
SMeta
*
metaOpen
(
SMetaOptions
*
);
void
metaClose
(
SMeta
*
);
int
metaCreateTable
(
SMeta
*
,
void
*
);
int
metaDropTable
(
SMeta
*
,
uint64_t
tuid_t
);
int
metaAlterTable
(
SMeta
*
,
void
*
);
int
metaCommit
(
SMeta
*
);
// Options
SMetaOptions
*
metaOptionsCreate
();
void
metaOptionsDestroy
(
SMetaOptions
*
);
void
metaOptionsSetCache
(
SMetaOptions
*
,
size_t
capacity
);
// SMetaQueryHandle
SMetaQueryHandle
*
metaQueryHandleCreate
(
SMetaQueryOptions
*
);
void
metaQueryHandleDestroy
(
SMetaQueryHandle
*
);
int
metaCreateTable
(
SMeta
*
pMeta
,
SCreateTableReq
*
pReq
);
int
metaDropTable
(
SMeta
*
pMeta
,
SDropTableReq
*
pReq
);
int
metaAlterTable
(
SMeta
*
pMeta
,
SAlterTableReq
*
pReq
);
int
metaCommit
(
SMeta
*
pMeta
);
// SMetaQueryOptions
SMetaQueryOptions
*
metaQueryOptionsCreate
();
void
metaQueryOptionsDestroy
(
SMetaQueryOptions
*
);
#ifdef __cplusplus
}
...
...
include/server/vnode/tsdb/tsdb.h
浏览文件 @
d89aae08
...
...
@@ -23,33 +23,60 @@
extern
"C"
{
#endif
typedef
struct
STsdb
STsdb
;
typedef
struct
{
int32_t
id
;
// TODO: use a global definition
int32_t
days
;
int32_t
keep
;
int32_t
keep1
;
int32_t
keep2
;
int32_t
minRows
;
int32_t
maxRows
;
int8_t
precision
;
int8_t
update
;
}
STsdbCfg
;
// Module init and clear
int
tsdbInit
();
int
tsdbClear
();
// Repository operations
int
tsdbCreateRepo
(
int
id
);
int
tsdbDropRepo
(
int
id
);
STsdb
*
tsdbOpenRepo
(
STsdbCfg
*
pCfg
);
int
tsdbCloseRepo
(
STsdb
*
pTsdb
);
int
tsdbForceCloseRepo
(
STsdb
*
pTsdb
);
// Data commit
int
tsdbInsert
(
STsdb
*
pTsdb
,
SSubmitReq
*
pMsg
);
int
tsdbCommit
(
STsdb
*
pTsdb
);
// Types exported
typedef
struct
STsdb
STsdb
;
typedef
struct
STsdbOptions
STsdbOptions
;
typedef
struct
STsdbSMAOptions
STsdbSMAOptions
;
// SMA stands for Small Materialized Aggregation
typedef
struct
STsdbReadOptions
STsdbReadOptions
;
typedef
struct
STsdbSnapshot
STsdbSnapshot
;
typedef
struct
STsdbQueryHandle
STsdbQueryHandle
;
// DB operations
int
tsdbCreate
(
const
char
*
path
);
int
tsdbDestroy
(
const
char
*
path
);
STsdb
*
tsdbOpen
(
const
STsdbOptions
*
options
);
void
tsdbClose
(
STsdb
*
);
int
tsdbReset
(
STsdb
*
,
const
STsdbOptions
*
);
int
tsdbInsert
(
STsdb
*
,
SSubmitReq
*
,
SSubmitRsp
*
);
int
tsdbCommit
(
STsdb
*
);
int
tsdbCompact
(
STsdb
*
);
// Options
STsdbOptions
*
tsdbOptionsCreate
();
void
tsdbOptionsDestroy
(
STsdbOptions
*
);
void
tsdbOptionsSetId
(
STsdbOptions
*
,
int
id
);
void
tsdbOptionsSetHoursPerFile
(
STsdbOptions
*
,
int
hours
);
void
tsdbOptionsSetRetention
(
STsdbOptions
*
,
int
keep
,
int
keep1
,
int
keep2
);
void
tsdbOptionsSetMinAndMaxRows
(
STsdbOptions
*
,
int
minRows
,
int
maxRows
);
void
tsdbOptionsSetPrecision
(
STsdbOptions
*
,
int
);
void
tsdbOptionsSetCache
(
STsdbOptions
*
,
int
);
typedef
enum
{
TSDB_NO_UPDATE
=
0
,
TSDB_WHOLE_ROW_UPDATE
=
1
,
TSDB_PARTIAL_ROW_UPDATE
=
2
}
ETsdbUpdateType
;
void
tsdbOptionsSetUpdate
(
STsdbOptions
*
,
ETsdbUpdateType
);
void
tsdbOptionsSetSMA
(
STsdbOptions
*
,
STsdbSMAOptions
*
);
// STsdbSMAOptions
STsdbSMAOptions
*
tsdbSMAOptionsCreate
();
void
tsdbSMAOptionsDestroy
(
STsdbSMAOptions
*
);
void
tsdbSMAOptionsSetFuncs
(
STsdbSMAOptions
*
,
SArray
*
/*Array of function to perform on each block*/
);
void
tsdbSMAOptionsSetIntervals
(
STsdbSMAOptions
*
,
SArray
*
);
void
tsdbSMAOptionsSetColTypes
(
STsdbSMAOptions
*
,
SArray
*
);
// STsdbQueryHandle
STsdbQueryHandle
*
tsdbQueryHandleCreate
(
STsdb
*
,
STsdbReadOptions
*
);
void
tsdbQueryHandleDestroy
(
STsdbQueryHandle
*
);
void
tsdbResetQueryHandle
(
STsdbQueryHandle
*
,
STsdbReadOptions
*
);
bool
tsdbNextDataBlock
(
STsdbQueryHandle
*
);
void
tsdbGetDataBlockInfo
(
STsdbQueryHandle
*
,
SDataBlockInfo
*
);
void
tsdbGetDataBlockStatisInfo
(
STsdbQueryHandle
*
,
SDataStatis
**
);
// STsdbReadOptions
STsdbReadOptions
*
tsdbReadOptionsCreate
();
void
tsdbReadOptionsDestroy
(
STsdbReadOptions
*
);
void
tsdbReadOptionsSetSnapshot
(
STsdbReadOptions
*
,
STsdbSnapshot
*
);
// STsdbSnapshot
STsdbSnapshot
*
tsdbSnapshotCreate
(
STsdb
*
);
void
tsdbSnapshotDestroy
(
STsdbSnapshot
*
);
#ifdef __cplusplus
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录