forked from TrueCloudLab/frostfs-node
Reapply "[#972] Use slices.Sort* when useful"
This reverts commit 3359349acb
.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
2c4b50a71e
commit
669103a33e
2 changed files with 4 additions and 9 deletions
|
@ -3,7 +3,7 @@ package control
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
rawclient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
rawclient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||||
|
@ -177,9 +177,6 @@ func getShardIDListFromIDFlag(cmd *cobra.Command, withAllFlag bool) [][]byte {
|
||||||
res = append(res, raw)
|
res = append(res, raw)
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Slice(res, func(i, j int) bool {
|
slices.SortFunc(res, bytes.Compare)
|
||||||
return bytes.Compare(res[i], res[j]) < 0
|
|
||||||
})
|
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"slices"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
|
||||||
|
@ -192,9 +192,7 @@ func testGetSubTreeOrderAsc(t *testing.T, p pilorama.ForestStorage) {
|
||||||
require.True(t, found, "unknown node %d %v", i, acc.seen[i].GetBody().GetNodeId())
|
require.True(t, found, "unknown node %d %v", i, acc.seen[i].GetBody().GetNodeId())
|
||||||
}
|
}
|
||||||
|
|
||||||
require.True(t, sort.SliceIsSorted(paths, func(i, j int) bool {
|
require.True(t, slices.IsSorted(paths))
|
||||||
return paths[i] < paths[j]
|
|
||||||
}))
|
|
||||||
})
|
})
|
||||||
t.Run("depth=1", func(t *testing.T) {
|
t.Run("depth=1", func(t *testing.T) {
|
||||||
acc := subTreeAcc{errIndex: -1}
|
acc := subTreeAcc{errIndex: -1}
|
||||||
|
|
Loading…
Reference in a new issue