[#1528] cli: Keep order for required nodes in the result of object nodes
All checks were successful
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m54s
DCO action / DCO (pull_request) Successful in 3m6s
Vulncheck / Vulncheck (pull_request) Successful in 3m59s
Build / Build Components (pull_request) Successful in 4m46s
Tests and linters / Run gofumpt (pull_request) Successful in 1m33s
Tests and linters / gopls check (pull_request) Successful in 2m46s
Tests and linters / Staticcheck (pull_request) Successful in 3m22s
Tests and linters / Tests (pull_request) Successful in 4m14s
Tests and linters / Lint (pull_request) Successful in 4m18s
Tests and linters / Tests with -race (pull_request) Successful in 5m7s
Tests and linters / Run gofumpt (push) Successful in 2m32s
Vulncheck / Vulncheck (push) Successful in 3m0s
Pre-commit hooks / Pre-commit (push) Successful in 3m14s
Build / Build Components (push) Successful in 3m34s
Tests and linters / Lint (push) Successful in 4m1s
Tests and linters / Staticcheck (push) Successful in 4m17s
Tests and linters / gopls check (push) Successful in 4m23s
Tests and linters / Tests (push) Successful in 5m12s
Tests and linters / Tests with -race (push) Successful in 6m6s
All checks were successful
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m54s
DCO action / DCO (pull_request) Successful in 3m6s
Vulncheck / Vulncheck (pull_request) Successful in 3m59s
Build / Build Components (pull_request) Successful in 4m46s
Tests and linters / Run gofumpt (pull_request) Successful in 1m33s
Tests and linters / gopls check (pull_request) Successful in 2m46s
Tests and linters / Staticcheck (pull_request) Successful in 3m22s
Tests and linters / Tests (pull_request) Successful in 4m14s
Tests and linters / Lint (pull_request) Successful in 4m18s
Tests and linters / Tests with -race (pull_request) Successful in 5m7s
Tests and linters / Run gofumpt (push) Successful in 2m32s
Vulncheck / Vulncheck (push) Successful in 3m0s
Pre-commit hooks / Pre-commit (push) Successful in 3m14s
Build / Build Components (push) Successful in 3m34s
Tests and linters / Lint (push) Successful in 4m1s
Tests and linters / Staticcheck (push) Successful in 4m17s
Tests and linters / gopls check (push) Successful in 4m23s
Tests and linters / Tests (push) Successful in 5m12s
Tests and linters / Tests with -race (push) Successful in 6m6s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
edfa3f4825
commit
635a292ae4
1 changed files with 0 additions and 32 deletions
|
@ -1,15 +1,12 @@
|
|||
package object
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"cmp"
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||
|
@ -507,7 +504,6 @@ func isObjectStoredOnNode(ctx context.Context, cmd *cobra.Command, cnrID cid.ID,
|
|||
}
|
||||
|
||||
func printPlacement(cmd *cobra.Command, objID oid.ID, objects []phyObject, result *objectNodesResult) {
|
||||
normilizeObjectNodesResult(objects, result)
|
||||
if json, _ := cmd.Flags().GetBool(commonflags.JSON); json {
|
||||
printObjectNodesAsJSON(cmd, objID, objects, result)
|
||||
} else {
|
||||
|
@ -515,34 +511,6 @@ func printPlacement(cmd *cobra.Command, objID oid.ID, objects []phyObject, resul
|
|||
}
|
||||
}
|
||||
|
||||
func normilizeObjectNodesResult(objects []phyObject, result *objectNodesResult) {
|
||||
slices.SortFunc(objects, func(lhs, rhs phyObject) int {
|
||||
if lhs.ecHeader == nil && rhs.ecHeader == nil {
|
||||
return bytes.Compare(lhs.objectID[:], rhs.objectID[:])
|
||||
}
|
||||
if lhs.ecHeader == nil {
|
||||
return -1
|
||||
}
|
||||
if rhs.ecHeader == nil {
|
||||
return 1
|
||||
}
|
||||
if lhs.ecHeader.parent == rhs.ecHeader.parent {
|
||||
return cmp.Compare(lhs.ecHeader.index, rhs.ecHeader.index)
|
||||
}
|
||||
return bytes.Compare(lhs.ecHeader.parent[:], rhs.ecHeader.parent[:])
|
||||
})
|
||||
for _, obj := range objects {
|
||||
op := result.placements[obj.objectID]
|
||||
slices.SortFunc(op.confirmedNodes, func(lhs, rhs netmapSDK.NodeInfo) int {
|
||||
return bytes.Compare(lhs.PublicKey(), rhs.PublicKey())
|
||||
})
|
||||
slices.SortFunc(op.requiredNodes, func(lhs, rhs netmapSDK.NodeInfo) int {
|
||||
return bytes.Compare(lhs.PublicKey(), rhs.PublicKey())
|
||||
})
|
||||
result.placements[obj.objectID] = op
|
||||
}
|
||||
}
|
||||
|
||||
func printObjectNodesAsText(cmd *cobra.Command, objID oid.ID, objects []phyObject, result *objectNodesResult) {
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "Object %s stores payload in %d data objects:\n", objID.EncodeToString(), len(objects))
|
||||
|
||||
|
|
Loading…
Reference in a new issue