From c14c9a023cbd96e12a60909f87f0d1e56ffba97b Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Wed, 20 Sep 2023 18:26:28 +0300 Subject: [PATCH] [#333] Sort objects by ID in SearchObjects Signed-off-by: Ekaterina Lebedeva --- cmd/frostfs-cli/internal/client/client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/frostfs-cli/internal/client/client.go b/cmd/frostfs-cli/internal/client/client.go index e8869bc8c..26d8aa83b 100644 --- a/cmd/frostfs-cli/internal/client/client.go +++ b/cmd/frostfs-cli/internal/client/client.go @@ -6,6 +6,8 @@ import ( "errors" "fmt" "io" + "sort" + "strings" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" @@ -727,6 +729,11 @@ func SearchObjects(ctx context.Context, prm SearchObjectsPrm) (*SearchObjectsRes return nil, fmt.Errorf("read object list: %w", err) } + sort.Slice(list, func(i, j int) bool { + lhs, rhs := list[i].EncodeToString(), list[j].EncodeToString() + return strings.Compare(lhs, rhs) < 0 + }) + return &SearchObjectsRes{ ids: list, }, nil