Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
500130da
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
500130da
编写于
11月 26, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update fst core struct
上级
16f089c3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
15 deletion
+70
-15
source/libs/index/inc/index_fst.h
source/libs/index/inc/index_fst.h
+21
-14
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+49
-1
未找到文件。
source/libs/index/inc/index_fst.h
浏览文件 @
500130da
...
@@ -219,6 +219,15 @@ bool fstNodeFindInput(FstNode *node, uint8_t b, uint64_t *res);
...
@@ -219,6 +219,15 @@ bool fstNodeFindInput(FstNode *node, uint8_t b, uint64_t *res);
bool
fstNodeCompile
(
FstNode
*
node
,
void
*
w
,
CompiledAddr
lastAddr
,
CompiledAddr
addr
,
FstBuilderNode
*
builderNode
);
bool
fstNodeCompile
(
FstNode
*
node
,
void
*
w
,
CompiledAddr
lastAddr
,
CompiledAddr
addr
,
FstBuilderNode
*
builderNode
);
FstSlice
fstNodeAsSlice
(
FstNode
*
node
);
FstSlice
fstNodeAsSlice
(
FstNode
*
node
);
// ops
typedef
struct
FstIndexedValue
{
uint64_t
index
;
uint64_t
value
;
}
FstIndexedValue
;
FstLastTransition
*
fstLastTransitionCreate
(
uint8_t
inp
,
Output
out
);
void
fstLastTransitionDestroy
(
FstLastTransition
*
trn
);
typedef
struct
FstMeta
{
typedef
struct
FstMeta
{
...
@@ -230,22 +239,20 @@ typedef struct FstMeta {
...
@@ -230,22 +239,20 @@ typedef struct FstMeta {
}
FstMeta
;
}
FstMeta
;
typedef
struct
Fst
{
typedef
struct
Fst
{
FstMeta
*
meta
;
FstMeta
*
meta
;
void
*
data
;
//
FstSlice
*
data
;
//
FstNode
*
root
;
//
}
Fst
;
}
Fst
;
Fst
*
fstCreate
(
FstSlice
*
data
);
// refactor simple function
void
fstDestroy
(
Fst
*
fst
);
// ops
typedef
struct
FstIndexedValue
{
uint64_t
index
;
uint64_t
value
;
}
FstIndexedValue
;
FstLastTransition
*
fstLastTransitionCreate
(
uint8_t
inp
,
Output
out
);
void
fstLastTransitionDestroy
(
FstLastTransition
*
trn
);
Fst
*
fstCreate
(
FstSlice
*
data
);
void
fstDestroy
(
Fst
*
fst
);
bool
fstGet
(
Fst
*
fst
,
FstSlice
*
b
,
Output
*
out
);
FstNode
*
fstGetNode
(
Fst
*
fst
,
CompiledAddr
);
FstType
fstGetType
(
Fst
*
fst
);
CompiledAddr
fstGetRootAddr
(
Fst
*
fst
);
Output
fstEmptyFinalOutput
(
Fst
*
fst
,
bool
*
null
);
bool
fstVerify
(
Fst
*
fst
);
#endif
#endif
source/libs/index/src/index_fst.c
浏览文件 @
500130da
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#include "index_fst.h"
#include "index_fst.h"
#include "tcoding.h"
#include "tcoding.h"
#include "tchecksum.h"
static
void
fstPackDeltaIn
(
FstCountingWriter
*
wrt
,
CompiledAddr
nodeAddr
,
CompiledAddr
transAddr
,
uint8_t
nBytes
)
{
static
void
fstPackDeltaIn
(
FstCountingWriter
*
wrt
,
CompiledAddr
nodeAddr
,
CompiledAddr
transAddr
,
uint8_t
nBytes
)
{
...
@@ -923,7 +924,6 @@ void fstBuilderNodeUnfinishedAddOutputPrefix(FstBuilderNodeUnfinished *unNode, O
...
@@ -923,7 +924,6 @@ void fstBuilderNodeUnfinishedAddOutputPrefix(FstBuilderNodeUnfinished *unNode, O
}
}
Fst
*
fstCreate
(
FstSlice
*
slice
)
{
Fst
*
fstCreate
(
FstSlice
*
slice
)
{
char
*
buf
=
slice
->
data
;
char
*
buf
=
slice
->
data
;
uint64_t
skip
=
0
;
uint64_t
skip
=
0
;
uint64_t
len
=
slice
->
dLen
;
uint64_t
len
=
slice
->
dLen
;
...
@@ -968,6 +968,7 @@ Fst* fstCreate(FstSlice *slice) {
...
@@ -968,6 +968,7 @@ Fst* fstCreate(FstSlice *slice) {
fst
->
meta
->
ty
=
type
;
fst
->
meta
->
ty
=
type
;
fst
->
meta
->
len
=
fstLen
;
fst
->
meta
->
len
=
fstLen
;
fst
->
meta
->
checkSum
=
checkSum
;
fst
->
meta
->
checkSum
=
checkSum
;
fst
->
data
=
slice
;
return
fst
;
return
fst
;
FST_CREAT_FAILED:
FST_CREAT_FAILED:
...
@@ -976,7 +977,54 @@ FST_CREAT_FAILED:
...
@@ -976,7 +977,54 @@ FST_CREAT_FAILED:
}
}
void
fstDestroy
(
Fst
*
fst
)
{
void
fstDestroy
(
Fst
*
fst
)
{
if
(
fst
)
{
free
(
fst
->
meta
);
fstNodeDestroy
(
fst
->
root
);
}
free
(
fst
);
}
bool
fstGet
(
Fst
*
fst
,
FstSlice
*
b
,
Output
*
out
)
{
return
false
;
}
FstNode
*
fstGetNode
(
Fst
*
fst
,
CompiledAddr
addr
)
{
if
(
fst
->
root
!=
NULL
)
{
return
fst
->
root
;
}
fst
->
root
=
fstNodeCreate
(
fst
->
meta
->
version
,
addr
,
fst
->
data
);
return
fst
->
root
;
}
FstType
fstGetType
(
Fst
*
fst
)
{
return
fst
->
meta
->
ty
;
}
CompiledAddr
fstGetRootAddr
(
Fst
*
fst
)
{
return
fst
->
meta
->
rootAddr
;
}
Output
fstEmptyFinalOutput
(
Fst
*
fst
,
bool
*
null
)
{
Output
res
=
0
;
FstNode
*
node
=
fst
->
root
;
if
(
FST_NODE_IS_FINAL
(
node
))
{
*
null
=
false
;
res
=
FST_NODE_FINAL_OUTPUT
(
node
);
}
else
{
*
null
=
true
;
}
return
res
;
}
bool
fstVerify
(
Fst
*
fst
)
{
uint32_t
checkSum
=
fst
->
meta
->
checkSum
;
FstSlice
*
data
=
fst
->
data
;
TSCKSUM
initSum
=
0
;
if
(
taosCheckChecksumWhole
(
data
->
data
,
data
->
dLen
))
{
return
false
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录