diff options
| author | a <eddy@gfxlabs.io> | 2022-04-20 14:01:42 -0700 |
|---|---|---|
| committer | a <eddy@gfxlabs.io> | 2022-04-20 14:01:42 -0700 |
| commit | 1d6a9e66b608f77a0da9a6903802bb24ff0629d7 (patch) | |
| tree | 7f3e02d6e69d10913d882c5f87d9156001e1b77c /weed/util | |
| parent | 846858fb436cc061c40c4f2565ed3682e3758596 (diff) | |
| parent | d1fd40358215a6237f51e0918659f74cc7269ff1 (diff) | |
| download | seaweedfs-1d6a9e66b608f77a0da9a6903802bb24ff0629d7.tar.xz seaweedfs-1d6a9e66b608f77a0da9a6903802bb24ff0629d7.zip | |
Merge branch 'master' into a
Diffstat (limited to 'weed/util')
| -rw-r--r-- | weed/util/chunk_cache/on_disk_cache_layer.go | 10 | ||||
| -rw-r--r-- | weed/util/constants.go | 2 | ||||
| -rw-r--r-- | weed/util/skiplist/name_batch.go | 6 |
3 files changed, 8 insertions, 10 deletions
diff --git a/weed/util/chunk_cache/on_disk_cache_layer.go b/weed/util/chunk_cache/on_disk_cache_layer.go index 9115b1bb1..de32fb445 100644 --- a/weed/util/chunk_cache/on_disk_cache_layer.go +++ b/weed/util/chunk_cache/on_disk_cache_layer.go @@ -2,12 +2,11 @@ package chunk_cache import ( "fmt" - "path" - "sort" - "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/storage/types" + "golang.org/x/exp/slices" + "path" ) type OnDiskCacheLayer struct { @@ -33,10 +32,9 @@ func NewOnDiskCacheLayer(dir, namePrefix string, diskSize int64, segmentCount in } // keep newest cache to the front - sort.Slice(c.diskCaches, func(i, j int) bool { - return c.diskCaches[i].lastModTime.After(c.diskCaches[j].lastModTime) + slices.SortFunc(c.diskCaches, func(a, b *ChunkCacheVolume) bool { + return a.lastModTime.After(b.lastModTime) }) - return c } diff --git a/weed/util/constants.go b/weed/util/constants.go index 14f3a0b91..5518f1c0e 100644 --- a/weed/util/constants.go +++ b/weed/util/constants.go @@ -5,7 +5,7 @@ import ( ) var ( - VERSION_NUMBER = fmt.Sprintf("%.02f", 2.98) + VERSION_NUMBER = fmt.Sprintf("%.02f", 2.99) VERSION = sizeLimit + " " + VERSION_NUMBER COMMIT = "" ) diff --git a/weed/util/skiplist/name_batch.go b/weed/util/skiplist/name_batch.go index 71e5aeeba..53db5918f 100644 --- a/weed/util/skiplist/name_batch.go +++ b/weed/util/skiplist/name_batch.go @@ -3,7 +3,7 @@ package skiplist import ( "github.com/chrislusf/seaweedfs/weed/glog" "github.com/golang/protobuf/proto" - "sort" + "golang.org/x/exp/slices" "strings" ) @@ -41,8 +41,8 @@ func (nb *NameBatch) ListNames(startFrom string, visitNamesFn func(name string) names = append(names, n) } } - sort.Slice(names, func(i, j int) bool { - return strings.Compare(names[i], names[j]) < 0 + slices.SortFunc(names, func(a, b string) bool { + return strings.Compare(a, b) < 0 }) for _, n := range names { if !visitNamesFn(n) { |
