Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding paging method to query service store iterator #3357

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

opudrovs
Copy link
Contributor

@opudrovs opudrovs commented Sep 14, 2023

Closes #3044

  • Added Page methods to iterators.

  • Re-ordered iterator methods for consistency.

  • Updated iterator fakes.

  • Added tests for pagination in iterators.

Notes:

  • The order or objects returned by i.result.Hits in indexerIterator, unlike sqliterator is mostly reverse (to the order the objects are seeded) and slightly inconsistent (this part needs to be re-checked, but I saw items for the first page returns in the order of name-7, name-6, name-5 or name-7, name-5, name-6).

  • Because of different behavior of sqliterator and indexerIterator, which implement the same Iterator interface, when calling the Page method for sqliterator, you need only to specify the initial offset, the iterator will advance its index automatically by calling Next. But with indexerIterator, you need to specify the offset each time when calling the Page method.

But the above-mentioned issues are of no concern to using Page methods during cleanup. If we need different iterator behavior later, we can research it further and rework it in another issue.

Testing:

  • The desired behavior of pagination in sqliterator and indexerIterator is described in tests. For now, just run
go test -v ./pkg/query/store

to make sure pagination works as expected.

@opudrovs opudrovs added enhancement New feature or request area/explorer labels Sep 14, 2023
@opudrovs opudrovs self-assigned this Sep 14, 2023
@opudrovs opudrovs force-pushed the 3044-add-paging-to-query-service-store-iterator branch 10 times, most recently from dbc35fe to a3341e2 Compare September 18, 2023 08:35
@opudrovs opudrovs marked this pull request as ready for review September 18, 2023 09:42
Copy link

@jpellizzari jpellizzari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very thorough. Excellent work!

@opudrovs
Copy link
Contributor Author

@jpellizzari thanks a ton! 🎉

Re-order iterator methods for consistency.

Update iterator fakes.

Add tests for pagination in iterators.
@opudrovs opudrovs force-pushed the 3044-add-paging-to-query-service-store-iterator branch from a3341e2 to 4c6014a Compare September 19, 2023 10:03
@opudrovs opudrovs merged commit 6804f43 into main Sep 19, 2023
10 checks passed
@opudrovs opudrovs deleted the 3044-add-paging-to-query-service-store-iterator branch September 19, 2023 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/explorer enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding paging method to query service store iterator
2 participants