Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

chore(deps): bump github.com/viant/ptrie from 0.3.1 to 1.0.1 (#5552)

dependabot[bot]36a1cf036180
diff --git a/go.mod b/go.mod
index 0cd43ebc65..37fd62ec1c 100644
--- a/go.mod
+++ b/go.mod
@@ -29,7 +29,6 @@ require (
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
github.com/fclairamb/ftpserverlib v0.24.0
github.com/fsnotify/fsnotify v1.7.0 // indirect
- github.com/go-errors/errors v1.5.1 // indirect
github.com/go-redis/redis/v8 v8.11.5
github.com/go-redsync/redsync/v4 v4.13.0
github.com/go-sql-driver/mysql v1.8.1
@@ -94,8 +93,7 @@ require (
github.com/tsuna/gohbase v0.0.0-20201125011725-348991136365
github.com/tylertreat/BoomFilters v0.0.0-20210315201527-1a82519a3e43
github.com/valyala/bytebufferpool v1.0.0
- github.com/viant/ptrie v0.3.1
- github.com/viant/toolbox v0.34.5 // indirect
+ github.com/viant/ptrie v1.0.1
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
diff --git a/go.sum b/go.sum
index 1387f6f893..d6751ff0bf 100644
--- a/go.sum
+++ b/go.sum
@@ -928,8 +928,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/viant/assertly v0.9.0 h1:uB3jO+qmWQcrSCHQRxA2kk88eXAdaklUUDxxCU5wBHQ=
github.com/viant/assertly v0.9.0/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
-github.com/viant/ptrie v0.3.1 h1:gIKbZBGET8ZcPkTZQMAUna9dHuLS8+bal+wl1fA1kHc=
-github.com/viant/ptrie v0.3.1/go.mod h1:Y+mwwNCIUgFrCZcrG4/QChfi4ubvnNBsyrENBIgigu0=
+github.com/viant/ptrie v1.0.1 h1:3fFC8XqCSchf11sCSS5sbb8eGDNEP2g2Hj96lNdHlZY=
+github.com/viant/ptrie v1.0.1/go.mod h1:Y+mwwNCIUgFrCZcrG4/QChfi4ubvnNBsyrENBIgigu0=
github.com/viant/toolbox v0.34.5 h1:szWNPiGHjo8Dd4v2a59saEhG31DRL2Xf3aJ0ZtTSuqc=
github.com/viant/toolbox v0.34.5/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlVjOeLOBz+CPAI8dnbqNSVwUwRrkp7vQ=
diff --git a/weed/filer/filer_conf.go b/weed/filer/filer_conf.go
index 554a00f58f..25bf837712 100644
--- a/weed/filer/filer_conf.go
+++ b/weed/filer/filer_conf.go
@@ -27,7 +27,7 @@ const (
)
type FilerConf struct {
- rules ptrie.Trie
+ rules ptrie.Trie[*filer_pb.FilerConf_PathConf]
}
func ReadFilerConf(filerGrpcAddress pb.ServerAddress, grpcDialOption grpc.DialOption, masterClient *wdclient.MasterClient) (*FilerConf, error) {
@@ -55,7 +55,7 @@ func ReadFilerConf(filerGrpcAddress pb.ServerAddress, grpcDialOption grpc.DialOp
func NewFilerConf() (fc *FilerConf) {
fc = &FilerConf{
- rules: ptrie.New(),
+ rules: ptrie.New[*filer_pb.FilerConf_PathConf](),
}
return fc
}
@@ -120,8 +120,8 @@ func (fc *FilerConf) AddLocationConf(locConf *filer_pb.FilerConf_PathConf) (err
}
func (fc *FilerConf) DeleteLocationConf(locationPrefix string) {
- rules := ptrie.New()
- fc.rules.Walk(func(key []byte, value interface{}) bool {
+ rules := ptrie.New[*filer_pb.FilerConf_PathConf]()
+ fc.rules.Walk(func(key []byte, value *filer_pb.FilerConf_PathConf) bool {
if string(key) == locationPrefix {
return true
}
@@ -135,9 +135,8 @@ func (fc *FilerConf) DeleteLocationConf(locationPrefix string) {
func (fc *FilerConf) MatchStorageRule(path string) (pathConf *filer_pb.FilerConf_PathConf) {
pathConf = &filer_pb.FilerConf_PathConf{}
- fc.rules.MatchPrefix([]byte(path), func(key []byte, value interface{}) bool {
- t := value.(*filer_pb.FilerConf_PathConf)
- mergePathConf(pathConf, t)
+ fc.rules.MatchPrefix([]byte(path), func(key []byte, value *filer_pb.FilerConf_PathConf) bool {
+ mergePathConf(pathConf, value)
return true
})
return pathConf
@@ -145,10 +144,9 @@ func (fc *FilerConf) MatchStorageRule(path string) (pathConf *filer_pb.FilerConf
func (fc *FilerConf) GetCollectionTtls(collection string) (ttls map[string]string) {
ttls = make(map[string]string)
- fc.rules.Walk(func(key []byte, value interface{}) bool {
- t := value.(*filer_pb.FilerConf_PathConf)
- if t.Collection == collection {
- ttls[t.LocationPrefix] = t.GetTtl()
+ fc.rules.Walk(func(key []byte, value *filer_pb.FilerConf_PathConf) bool {
+ if value.Collection == collection {
+ ttls[value.LocationPrefix] = value.GetTtl()
}
return true
})
@@ -176,9 +174,8 @@ func mergePathConf(a, b *filer_pb.FilerConf_PathConf) {
func (fc *FilerConf) ToProto() *filer_pb.FilerConf {
m := &filer_pb.FilerConf{}
- fc.rules.Walk(func(key []byte, value interface{}) bool {
- pathConf := value.(*filer_pb.FilerConf_PathConf)
- m.Locations = append(m.Locations, pathConf)
+ fc.rules.Walk(func(key []byte, value *filer_pb.FilerConf_PathConf) bool {
+ m.Locations = append(m.Locations, value)
return true
})
return m
diff --git a/weed/filer/filerstore_wrapper.go b/weed/filer/filerstore_wrapper.go
index 986dadb77f..d3beaba89b 100644
--- a/weed/filer/filerstore_wrapper.go
+++ b/weed/filer/filerstore_wrapper.go
@@ -32,7 +32,7 @@ type VirtualFilerStore interface {
type FilerStoreWrapper struct {
defaultStore FilerStore
- pathToStore ptrie.Trie
+ pathToStore ptrie.Trie[string]
storeIdToStore map[string]FilerStore
}
@@ -42,7 +42,7 @@ func NewFilerStoreWrapper(store FilerStore) *FilerStoreWrapper {
}
return &FilerStoreWrapper{
defaultStore: store,
- pathToStore: ptrie.New(),
+ pathToStore: ptrie.New[string](),
storeIdToStore: make(map[string]FilerStore),
}
}
@@ -89,8 +89,8 @@ func (fsw *FilerStoreWrapper) getActualStore(path util.FullPath) (store FilerSto
return
}
var storeId string
- fsw.pathToStore.MatchPrefix([]byte(path), func(key []byte, value interface{}) bool {
- storeId = value.(string)
+ fsw.pathToStore.MatchPrefix([]byte(path), func(key []byte, value string) bool {
+ storeId = value
return false
})
if storeId != "" {
diff --git a/weed/filer/remote_storage.go b/weed/filer/remote_storage.go
index 88e7e96142..3764fbac6d 100644
--- a/weed/filer/remote_storage.go
+++ b/weed/filer/remote_storage.go
@@ -21,13 +21,13 @@ const REMOTE_STORAGE_CONF_SUFFIX = ".conf"
const REMOTE_STORAGE_MOUNT_FILE = "mount.mapping"
type FilerRemoteStorage struct {
- rules ptrie.Trie
+ rules ptrie.Trie[*remote_pb.RemoteStorageLocation]
storageNameToConf map[string]*remote_pb.RemoteConf
}
func NewFilerRemoteStorage() (rs *FilerRemoteStorage) {
rs = &FilerRemoteStorage{
- rules: ptrie.New(),
+ rules: ptrie.New[*remote_pb.RemoteStorageLocation](),
storageNameToConf: make(map[string]*remote_pb.RemoteConf),
}
return rs
@@ -82,9 +82,9 @@ func (rs *FilerRemoteStorage) mapDirectoryToRemoteStorage(dir util.FullPath, loc
}
func (rs *FilerRemoteStorage) FindMountDirectory(p util.FullPath) (mountDir util.FullPath, remoteLocation *remote_pb.RemoteStorageLocation) {
- rs.rules.MatchPrefix([]byte(p), func(key []byte, value interface{}) bool {
+ rs.rules.MatchPrefix([]byte(p), func(key []byte, value *remote_pb.RemoteStorageLocation) bool {
mountDir = util.FullPath(string(key[:len(key)-1]))
- remoteLocation = value.(*remote_pb.RemoteStorageLocation)
+ remoteLocation = value
return true
})
return
@@ -92,8 +92,8 @@ func (rs *FilerRemoteStorage) FindMountDirectory(p util.FullPath) (mountDir util
func (rs *FilerRemoteStorage) FindRemoteStorageClient(p util.FullPath) (client remote_storage.RemoteStorageClient, remoteConf *remote_pb.RemoteConf, found bool) {
var storageLocation *remote_pb.RemoteStorageLocation
- rs.rules.MatchPrefix([]byte(p), func(key []byte, value interface{}) bool {
- storageLocation = value.(*remote_pb.RemoteStorageLocation)
+ rs.rules.MatchPrefix([]byte(p), func(key []byte, value *remote_pb.RemoteStorageLocation) bool {
+ storageLocation = value
return true
})