Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d39f8018
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
提交
d39f8018
编写于
11月 25, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update fst core struct
上级
20203e47
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
4 deletion
+38
-4
source/libs/index/inc/index_fst_counting_writer.h
source/libs/index/inc/index_fst_counting_writer.h
+1
-0
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+22
-4
source/libs/index/src/index_fst_counting_writer.c
source/libs/index/src/index_fst_counting_writer.c
+15
-0
未找到文件。
source/libs/index/inc/index_fst_counting_writer.h
浏览文件 @
d39f8018
...
...
@@ -35,6 +35,7 @@ void fstCountingWriterDestroy(FstCountingWriter *w);
void
fstCountingWriterPackUintIn
(
FstCountingWriter
*
writer
,
uint64_t
n
,
uint8_t
nBytes
);
uint8_t
fstCountingWriterPackUint
(
FstCountingWriter
*
writer
,
uint64_t
n
);
#define FST_WRITER_COUNT(writer) (writer->count)
...
...
source/libs/index/src/index_fst.c
浏览文件 @
d39f8018
...
...
@@ -21,9 +21,10 @@ static void fstPackDeltaIn(FstCountingWriter *wrt, CompiledAddr nodeAddr, Compil
CompiledAddr
deltaAddr
=
(
transAddr
==
EMPTY_ADDRESS
)
?
EMPTY_ADDRESS
:
nodeAddr
-
transAddr
;
fstCountingWriterPackUintIn
(
wrt
,
deltaAddr
,
nBytes
);
}
static
void
fstPackDetla
(
FstCountingWriter
*
wrt
,
CompiledAddr
nodeAddr
,
CompiledAddr
transAddr
)
{
static
uint8_t
fstPackDetla
(
FstCountingWriter
*
wrt
,
CompiledAddr
nodeAddr
,
CompiledAddr
transAddr
)
{
uint8_t
nBytes
=
packDeltaSize
(
nodeAddr
,
transAddr
);
fstPackDeltaIn
(
wrt
,
nodeAddr
,
transAddr
,
nBytes
);
return
nBytes
;
}
FstUnFinishedNodes
*
fstUnFinishedNodesCreate
()
{
...
...
@@ -213,8 +214,24 @@ void fstStateCompileForOneTransNext(FstCountingWriter *w, CompiledAddr addr, uin
return
;
}
void
fstStateCompileForOneTrans
(
FstCountingWriter
*
w
,
CompiledAddr
addr
,
FstTransition
*
trn
)
{
Output
val
=
trn
->
out
;
Output
out
=
trn
->
out
;
uint8_t
outPackSize
=
(
out
==
0
?
0
:
fstCountingWriterPackUint
(
w
,
out
));
uint8_t
transPackSize
=
fstPackDetla
(
w
,
addr
,
trn
->
addr
);
PackSizes
packSizes
=
0
;
FST_SET_OUTPUT_PACK_SIZE
(
packSizes
,
outPackSize
);
FST_SET_TRANSITION_PACK_SIZE
(
packSizes
,
transPackSize
);
fstCountingWriterWrite
(
w
,
(
char
*
)
&
packSizes
,
sizeof
(
packSizes
));
FstState
st
=
fstStateCreate
(
OneTrans
);
fstStateSetCommInput
(
&
st
,
trn
->
inp
);
bool
null
=
false
;
uint8_t
inp
=
fstStateCommInput
(
&
st
,
&
null
);
if
(
null
==
true
)
{
fstCountingWriterWrite
(
w
,
(
char
*
)
&
trn
->
inp
,
sizeof
(
trn
->
inp
));
}
fstCountingWriterWrite
(
w
,
(
char
*
)(
&
(
st
.
val
)),
sizeof
(
st
.
val
));
return
;
}
...
...
@@ -267,7 +284,7 @@ void fstStateCompileForAnyTrans(FstCountingWriter *w, CompiledAddr addr, FstBuil
// at that index. (Except when there are 256 transitions.) Namely,
// any value greater than or equal to the number of transitions in
// this node indicates an absent transition.
uint8_t
*
index
=
malloc
(
sizeof
(
uint8_t
)
*
256
);
uint8_t
*
index
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
)
*
256
);
for
(
uint8_t
i
=
0
;
i
<
256
;
i
++
)
{
index
[
i
]
=
255
;
}
...
...
@@ -277,6 +294,7 @@ void fstStateCompileForAnyTrans(FstCountingWriter *w, CompiledAddr addr, FstBuil
fstCountingWriterWrite
(
w
,
(
char
*
)
index
,
sizeof
(
index
));
//fstPackDeltaIn(w, addr, t->addr, tSize);
}
free
(
index
);
}
fstCountingWriterWrite
(
w
,
(
char
*
)
&
packSizes
,
1
);
bool
null
=
false
;
...
...
source/libs/index/src/index_fst_counting_writer.c
浏览文件 @
d39f8018
...
...
@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tutil.h"
#include "index_fst_util.h"
#include "index_fst_counting_writer.h"
FstCountingWriter
*
fstCountingWriterCreate
(
void
*
wrt
)
{
...
...
@@ -42,7 +43,21 @@ int fstCountingWriterFlush(FstCountingWriter *write) {
}
void
fstCountingWriterPackUintIn
(
FstCountingWriter
*
writer
,
uint64_t
n
,
uint8_t
nBytes
)
{
assert
(
1
<=
nBytes
&&
nBytes
<=
8
);
uint8_t
*
buf
=
calloc
(
8
,
sizeof
(
uint8_t
));
for
(
uint8_t
i
=
0
;
i
<
nBytes
;
i
++
)
{
buf
[
i
]
=
(
uint8_t
)
n
;
n
=
n
>>
8
;
}
fstCountingWriterWrite
(
writer
,
buf
,
nBytes
);
free
(
buf
);
return
;
}
uint8_t
fstCountingWriterPackUint
(
FstCountingWriter
*
writer
,
uint64_t
n
)
{
uint8_t
nBytes
=
packSize
(
n
);
fstCountingWriterPackUintIn
(
writer
,
n
,
nBytes
);
return
nBytes
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录