summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-store
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/codeberg.org/gruf/go-store')
-rw-r--r--vendor/codeberg.org/gruf/go-store/v2/storage/block.go4
-rw-r--r--vendor/codeberg.org/gruf/go-store/v2/storage/disk.go10
-rw-r--r--vendor/codeberg.org/gruf/go-store/v2/storage/fs.go2
-rw-r--r--vendor/codeberg.org/gruf/go-store/v2/util/pool.go14
4 files changed, 16 insertions, 14 deletions
diff --git a/vendor/codeberg.org/gruf/go-store/v2/storage/block.go b/vendor/codeberg.org/gruf/go-store/v2/storage/block.go
index b1081cb1c..f41099c75 100644
--- a/vendor/codeberg.org/gruf/go-store/v2/storage/block.go
+++ b/vendor/codeberg.org/gruf/go-store/v2/storage/block.go
@@ -676,10 +676,6 @@ func (st *BlockStorage) nodePathForKey(key string) (string, error) {
pb := util.GetPathBuilder()
defer util.PutPathBuilder(pb)
- // Append the nodepath to key
- pb.AppendString(st.nodePath)
- pb.AppendString(key)
-
// Return joined + cleaned node-path
return pb.Join(st.nodePath, key), nil
}
diff --git a/vendor/codeberg.org/gruf/go-store/v2/storage/disk.go b/vendor/codeberg.org/gruf/go-store/v2/storage/disk.go
index dab1d6128..ef6993edd 100644
--- a/vendor/codeberg.org/gruf/go-store/v2/storage/disk.go
+++ b/vendor/codeberg.org/gruf/go-store/v2/storage/disk.go
@@ -394,16 +394,16 @@ func (st *DiskStorage) filepath(key string) (string, error) {
pb := util.GetPathBuilder()
defer util.PutPathBuilder(pb)
- // Generated joined root path
- pb.AppendString(st.path)
- pb.AppendString(key)
+ // Generate key path
+ pb.Append(st.path)
+ pb.Append(key)
// Check for dir traversal outside of root
- if isDirTraversal(st.path, pb.StringPtr()) {
+ if isDirTraversal(st.path, pb.String()) {
return "", ErrInvalidKey
}
- return pb.String(), nil
+ return string(pb.B), nil
}
// isDirTraversal will check if rootPlusPath is a dir traversal outside of root,
diff --git a/vendor/codeberg.org/gruf/go-store/v2/storage/fs.go b/vendor/codeberg.org/gruf/go-store/v2/storage/fs.go
index 658b7e762..48a5806f2 100644
--- a/vendor/codeberg.org/gruf/go-store/v2/storage/fs.go
+++ b/vendor/codeberg.org/gruf/go-store/v2/storage/fs.go
@@ -5,7 +5,7 @@ import (
"os"
"syscall"
- "codeberg.org/gruf/go-fastpath"
+ "codeberg.org/gruf/go-fastpath/v2"
"codeberg.org/gruf/go-store/v2/util"
)
diff --git a/vendor/codeberg.org/gruf/go-store/v2/util/pool.go b/vendor/codeberg.org/gruf/go-store/v2/util/pool.go
index dc35dae01..ec5b501fe 100644
--- a/vendor/codeberg.org/gruf/go-store/v2/util/pool.go
+++ b/vendor/codeberg.org/gruf/go-store/v2/util/pool.go
@@ -1,16 +1,22 @@
package util
import (
- "codeberg.org/gruf/go-fastpath"
- "codeberg.org/gruf/go-pools"
+ "sync"
+
+ "codeberg.org/gruf/go-fastpath/v2"
)
// pathBuilderPool is the global fastpath.Builder pool.
-var pathBuilderPool = pools.NewPathBuilderPool(512)
+var pathBuilderPool = sync.Pool{
+ New: func() any {
+ return &fastpath.Builder{B: make([]byte, 0, 512)}
+ },
+}
// GetPathBuilder fetches a fastpath.Builder object from the pool.
func GetPathBuilder() *fastpath.Builder {
- return pathBuilderPool.Get()
+ pb, _ := pathBuilderPool.Get().(*fastpath.Builder)
+ return pb
}
// PutPathBuilder places supplied fastpath.Builder back in the pool.