Skip to content

Commit be33bbb

Browse files
committed
ipfs: fix LRU module violating semantic versioning
1 parent a5b137e commit be33bbb

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/adrg/xdg v0.4.0
77
github.com/charmbracelet/glamour v0.6.0
88
github.com/djdv/p9 v0.2.1-0.20230601152255-7d74b92b80b0
9-
github.com/hashicorp/golang-lru/v2 v2.0.2
9+
github.com/hashicorp/golang-lru/arc/v2 v2.0.7
1010
github.com/ipfs/boxo v0.10.2-0.20230629143123-2d3edc552442
1111
github.com/ipfs/go-cid v0.4.1
1212
github.com/ipfs/go-ipfs-cmds v0.9.0
@@ -26,6 +26,8 @@ require (
2626
golang.org/x/term v0.9.0
2727
)
2828

29+
require github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
30+
2931
require (
3032
github.com/alecthomas/chroma v0.10.0 // indirect
3133
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfm
8181
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
8282
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
8383
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
84-
github.com/hashicorp/golang-lru/v2 v2.0.2 h1:Dwmkdr5Nc/oBiXgJS3CDHNhJtIHkuZ3DZF5twqnfBdU=
85-
github.com/hashicorp/golang-lru/v2 v2.0.2/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
84+
github.com/hashicorp/golang-lru/arc/v2 v2.0.7 h1:QxkVTxwColcduO+LP7eJO56r2hFiG8zEbfAAzRv52KQ=
85+
github.com/hashicorp/golang-lru/arc/v2 v2.0.7/go.mod h1:Pe7gBlGdc8clY5LJ0LpJXMt5AmgmWNH1g+oFFVUHOEc=
86+
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
87+
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
8688
github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714 h1:/jC7qQFrv8CrSJVmaolDVOxTfS9kc36uB6H40kdbQq8=
8789
github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714/go.mod h1:2Goc3h8EklBH5mspfHFxBnEoURQCGzQQH1ga9Myjvis=
8890
github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY=

internal/filesystem/ipfs/ipfs.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/djdv/go-filesystem-utils/internal/filesystem"
1111
fserrors "github.com/djdv/go-filesystem-utils/internal/filesystem/errors"
1212
"github.com/djdv/go-filesystem-utils/internal/generic"
13-
lru "github.com/hashicorp/golang-lru/v2"
13+
"github.com/hashicorp/golang-lru/arc/v2"
1414
coreiface "github.com/ipfs/boxo/coreiface"
1515
coreoptions "github.com/ipfs/boxo/coreiface/options"
1616
corepath "github.com/ipfs/boxo/coreiface/path"
@@ -26,8 +26,8 @@ type (
2626
ipld.Node
2727
*nodeInfo
2828
}
29-
ipfsNodeCache = lru.ARCCache[cid.Cid, ipfsRecord]
30-
ipfsDirCache = lru.ARCCache[cid.Cid, []filesystem.StreamDirEntry]
29+
ipfsNodeCache = arc.ARCCache[cid.Cid, ipfsRecord]
30+
ipfsDirCache = arc.ARCCache[cid.Cid, []filesystem.StreamDirEntry]
3131
IPFS struct {
3232
ctx context.Context
3333
cancel context.CancelFunc
@@ -102,7 +102,7 @@ func (settings *ipfsSettings) fillInDefaults() error {
102102
}
103103

104104
func (settings *ipfsSettings) initNodeCache(count int) error {
105-
nodeCache, err := lru.NewARC[cid.Cid, ipfsRecord](count)
105+
nodeCache, err := arc.NewARC[cid.Cid, ipfsRecord](count)
106106
if err != nil {
107107
return err
108108
}
@@ -111,7 +111,7 @@ func (settings *ipfsSettings) initNodeCache(count int) error {
111111
}
112112

113113
func (settings *ipfsSettings) initDirectoryCache(count int) error {
114-
dirCache, err := lru.NewARC[cid.Cid, []filesystem.StreamDirEntry](count)
114+
dirCache, err := arc.NewARC[cid.Cid, []filesystem.StreamDirEntry](count)
115115
if err != nil {
116116
return err
117117
}

internal/filesystem/ipfs/ipns.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/djdv/go-filesystem-utils/internal/filesystem"
1414
fserrors "github.com/djdv/go-filesystem-utils/internal/filesystem/errors"
15-
lru "github.com/hashicorp/golang-lru/v2"
15+
"github.com/hashicorp/golang-lru/arc/v2"
1616
coreiface "github.com/ipfs/boxo/coreiface"
1717
corepath "github.com/ipfs/boxo/coreiface/path"
1818
ipath "github.com/ipfs/boxo/path"
@@ -26,7 +26,7 @@ type (
2626
*cid.Cid
2727
*time.Time
2828
}
29-
ipnsRootCache = lru.ARCCache[string, ipnsRecord]
29+
ipnsRootCache = arc.ARCCache[string, ipnsRecord]
3030
IPNS struct {
3131
ctx context.Context
3232
core coreiface.CoreAPI
@@ -99,7 +99,7 @@ func (settings *ipnsSettings) fillInDefaults() error {
9999
}
100100

101101
func (settings *ipnsSettings) initRootCache(cacheSize int) error {
102-
rootCache, err := lru.NewARC[string, ipnsRecord](cacheSize)
102+
rootCache, err := arc.NewARC[string, ipnsRecord](cacheSize)
103103
if err != nil {
104104
return err
105105
}

0 commit comments

Comments
 (0)