forked from TrueCloudLab/frostfs-node
Reapply "[#972] Adopt slices.BinarySearch()"
This reverts commit 4bfc6d29b9
.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
3dc81cb4fc
commit
2ca5dfc2f6
1 changed files with 3 additions and 2 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
|
||||||
|
@ -446,7 +447,7 @@ func getCIDFilterFunc(cmd *cobra.Command) (func([]byte) bool, error) {
|
||||||
var id cid.ID
|
var id cid.ID
|
||||||
id.SetSHA256(v)
|
id.SetSHA256(v)
|
||||||
idStr := id.EncodeToString()
|
idStr := id.EncodeToString()
|
||||||
n := sort.Search(len(rawIDs), func(i int) bool { return rawIDs[i] >= idStr })
|
_, found := slices.BinarySearch(rawIDs, idStr)
|
||||||
return n < len(rawIDs) && rawIDs[n] == idStr
|
return found
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue