Replace `ListPostings.Seek`'s binary search call by the generic `slices.BinarySearch` (#14393)

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
This commit is contained in:
Oleg Zaytsev 2024-07-02 15:51:05 +02:00 committed by GitHub
parent 9cf4b969dd
commit 726ed124e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 3 deletions

View File

@ -755,9 +755,7 @@ func (it *ListPostings) Seek(x storage.SeriesRef) bool {
} }
// Do binary search between current position and end. // Do binary search between current position and end.
i := sort.Search(len(it.list), func(i int) bool { i, _ := slices.BinarySearch(it.list, x)
return it.list[i] >= x
})
if i < len(it.list) { if i < len(it.list) {
it.cur = it.list[i] it.cur = it.list[i]
it.list = it.list[i+1:] it.list = it.list[i+1:]