Skip to content

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

:arrow_up: Upgrade kernel deps

Danielc765bcc36ff1
diff --git a/kernel/cache/ial.go b/kernel/cache/ial.go
index 2cb72c03cb..7d536ad6a3 100644
--- a/kernel/cache/ial.go
+++ b/kernel/cache/ial.go
@@ -23,7 +23,7 @@ import (
"github.com/dgraph-io/ristretto"
)
-var docIALCache, _ = ristretto.NewCache(&ristretto.Config{
+var docIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{
NumCounters: 1024 * 100,
MaxCost: 1024 * 1024 * 200,
BufferItems: 64,
@@ -40,7 +40,7 @@ func GetDocIAL(p string) (ret map[string]string) {
}
ret = map[string]string{}
- for k, v := range ial.(map[string]string) {
+ for k, v := range ial {
ret[k] = strings.ReplaceAll(v, editor.IALValEscNewLine, "\n")
}
return
@@ -54,7 +54,7 @@ func ClearDocsIAL() {
docIALCache.Clear()
}
-var blockIALCache, _ = ristretto.NewCache(&ristretto.Config{
+var blockIALCache, _ = ristretto.NewCache[string, map[string]string](&ristretto.Config[string, map[string]string]{
NumCounters: 1024 * 1000,
MaxCost: 1024 * 1024 * 200,
BufferItems: 64,
@@ -69,7 +69,7 @@ func GetBlockIAL(id string) (ret map[string]string) {
if nil == ial {
return
}
- return ial.(map[string]string)
+ return ial
}
func RemoveBlockIAL(id string) {
diff --git a/kernel/go.mod b/kernel/go.mod
index 4590a475ff..db0ae0c343 100644
--- a/kernel/go.mod
+++ b/kernel/go.mod
@@ -54,7 +54,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/sashabaranov/go-openai v1.29.1
github.com/shirou/gopsutil/v3 v3.24.5
- github.com/siyuan-note/dejavu v0.0.0-20240922022610-033cc35db309
+ github.com/siyuan-note/dejavu v0.0.0-20240922023411-ba02dd7afac9
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97
github.com/siyuan-note/filelock v0.0.0-20240724034355-d1ed7bf21d04
diff --git a/kernel/go.sum b/kernel/go.sum
index 0371f6ce79..2909f73401 100644
--- a/kernel/go.sum
+++ b/kernel/go.sum
@@ -332,8 +332,8 @@ github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+D
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=
-github.com/siyuan-note/dejavu v0.0.0-20240922022610-033cc35db309 h1:jo6rn0qK4YEXlRvNrZzHC/zdOErCNh61ad57EO8O0ow=
-github.com/siyuan-note/dejavu v0.0.0-20240922022610-033cc35db309/go.mod h1:3Hl2ttBIdfRMhzJ+WEvbuYokL3JLSMj8jObn96hrWt4=
+github.com/siyuan-note/dejavu v0.0.0-20240922023411-ba02dd7afac9 h1:TRIWGA/sP4T2eAEJSNpNhct8iGHDIGyXEtSnq2FYnwQ=
+github.com/siyuan-note/dejavu v0.0.0-20240922023411-ba02dd7afac9/go.mod h1:3Hl2ttBIdfRMhzJ+WEvbuYokL3JLSMj8jObn96hrWt4=
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/evyW6LcB9IQT8PR4ppx8JVqOFP9Ix3rfwSrc=
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8=
diff --git a/kernel/model/virutalref.go b/kernel/model/virutalref.go
index aa9bf62c58..d47286acc8 100644
--- a/kernel/model/virutalref.go
+++ b/kernel/model/virutalref.go
@@ -37,7 +37,7 @@ import (
// virtualBlockRefCache 用于保存块关联的虚拟引用关键字。
// 改进打开虚拟引用后加载文档的性能 https://github.com/siyuan-note/siyuan/issues/7378
-var virtualBlockRefCache, _ = ristretto.NewCache(&ristretto.Config{
+var virtualBlockRefCache, _ = ristretto.NewCache[string, []string](&ristretto.Config[string, []string]{
NumCounters: 102400,
MaxCost: 10240,
BufferItems: 64,
@@ -60,7 +60,7 @@ func getBlockVirtualRefKeywords(root *ast.Node) (ret []string) {
ret = putBlockVirtualRefKeywords(content, root)
return
}
- ret = val.([]string)
+ ret = val
return
}
@@ -216,7 +216,7 @@ func getVirtualRefKeywords(root *ast.Node) (ret []string) {
}
if val, ok := virtualBlockRefCache.Get("virtual_ref"); ok {
- ret = val.([]string)
+ ret = val
}
if "" != strings.TrimSpace(Conf.Editor.VirtualBlockRefInclude) {
diff --git a/kernel/sql/cache.go b/kernel/sql/cache.go
index 3e18c19fe1..b9ca037f47 100644
--- a/kernel/sql/cache.go
+++ b/kernel/sql/cache.go
@@ -37,7 +37,7 @@ func disableCache() {
cacheDisabled = true
}
-var blockCache, _ = ristretto.NewCache(&ristretto.Config{
+var blockCache, _ = ristretto.NewCache[string, *Block](&ristretto.Config[string, *Block]{
NumCounters: 102400,
MaxCost: 10240,
BufferItems: 64,
@@ -67,7 +67,7 @@ func getBlockCache(id string) (ret *Block) {
b, _ := blockCache.Get(id)
if nil != b {
- ret = b.(*Block)
+ ret = b
}
return
}