Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 块数统计

Liang Dinga2806ae82330
diff --git a/kernel/model/box.go b/kernel/model/box.go
index f37a44878c..0da197d69c 100644
--- a/kernel/model/box.go
+++ b/kernel/model/box.go
@@ -68,9 +68,9 @@ func autoStat() {
defer statLock.Unlock()
Conf.Stat.TreeCount = treenode.CountTrees()
- Conf.Stat.CTreeCount = treenode.CeilCount(Conf.Stat.TreeCount)
+ Conf.Stat.CTreeCount = treenode.CeilTreeCount(Conf.Stat.TreeCount)
Conf.Stat.BlockCount = treenode.CountBlocks()
- Conf.Stat.CBlockCount = treenode.CeilCount(Conf.Stat.BlockCount)
+ Conf.Stat.CBlockCount = treenode.CeilBlockCount(Conf.Stat.BlockCount)
Conf.Stat.DataSize, Conf.Stat.AssetsSize = util.DataSize()
Conf.Stat.CDataSize = util.CeilSize(Conf.Stat.DataSize)
Conf.Stat.CAssetsSize = util.CeilSize(Conf.Stat.AssetsSize)
diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go
index b79754cb3e..0b856fbd4d 100644
--- a/kernel/treenode/blocktree.go
+++ b/kernel/treenode/blocktree.go
@@ -71,7 +71,7 @@ func CountBlocks() (ret int) {
return len(blockTrees)
}
-func CeilCount(count int) int {
+func CeilTreeCount(count int) int {
if 100 > count {
return 100
}
@@ -84,6 +84,19 @@ func CeilCount(count int) int {
return 500*40 + 1
}
+func CeilBlockCount(count int) int {
+ if 5000 > count {
+ return 5000
+ }
+
+ for i := 1; i < 100; i++ {
+ if count < i*10000 {
+ return i * 10000
+ }
+ }
+ return 10000*100 + 1
+}
+
func GetBlockTreeRootByPath(boxID, path string) *BlockTree {
blockTreesLock.Lock()
defer blockTreesLock.Unlock()