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

List: add pagination support #321

Merged
merged 11 commits into from
Apr 12, 2023
Merged

List: add pagination support #321

merged 11 commits into from
Apr 12, 2023

Conversation

glimchb
Copy link
Member

@glimchb glimchb commented Apr 10, 2023

see https://google.aip.dev/132 and https://google.aip.dev/158

If API returned partial result:

  • generate new NextPageToken based on UUID
  • return the token in the response
  • save the token to re-use later on
  • Empty NextPageToken indicates end of results list

If non empty token received in API request:

  • received token, find it in local DB and retrieve offset
  • return results starting from offset

Token expiration is not implemeted yet.

Signed-off-by: Boris Glimcher [email protected]

@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Merging #321 (997e2a6) into main (b707642) will decrease coverage by 1.09%.
The diff coverage is 60.86%.

@@            Coverage Diff             @@
##             main     #321      +/-   ##
==========================================
- Coverage   74.50%   73.41%   -1.09%     
==========================================
  Files          16       16              
  Lines        1961     2024      +63     
==========================================
+ Hits         1461     1486      +25     
- Misses        454      492      +38     
  Partials       46       46              
Impacted Files Coverage Δ
pkg/frontend/scsi.go 0.00% <0.00%> (ø)
pkg/server/utils.go 0.00% <0.00%> (ø)
pkg/backend/aio.go 93.18% <100.00%> (+0.11%) ⬆️
pkg/backend/backend.go 100.00% <100.00%> (ø)
pkg/backend/null.go 93.18% <100.00%> (+0.11%) ⬆️
pkg/backend/nvme.go 89.06% <100.00%> (+0.26%) ⬆️
pkg/frontend/blk.go 89.16% <100.00%> (+0.27%) ⬆️
pkg/frontend/frontend.go 69.56% <100.00%> (+1.38%) ⬆️
pkg/frontend/nvme.go 88.66% <100.00%> (+0.23%) ⬆️
pkg/middleend/middleend.go 92.62% <100.00%> (+0.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@glimchb glimchb force-pushed the ci branch 6 times, most recently from a015d03 to cbfe5a9 Compare April 10, 2023 22:48
glimchb added 4 commits April 11, 2023 18:49
If API returned partial result:
- generate new NextPageToken based on UUID
- return the token in the responce
- save the token to re-use later on
- Empty NextPageToken indicates end of results list

Token expiration is not implemeted yet.

Signed-off-by: Boris Glimcher <[email protected]>
Signed-off-by: Boris Glimcher <[email protected]>
According to Google AIP, if PageSize is zero
means not provided by user, reasonable default
value should be used

Signed-off-by: Boris Glimcher <[email protected]>
@glimchb glimchb changed the title List: generate NextPageToken List: add pagination support Apr 11, 2023
glimchb added 3 commits April 12, 2023 03:38
According to Google AIP, max PageSize value
shoould be limited to a reasonable max value

Signed-off-by: Boris Glimcher <[email protected]>
introduce new ExtractPagination function

Signed-off-by: Boris Glimcher <[email protected]>
introduce new LimitPagination function

Signed-off-by: Boris Glimcher <[email protected]>
@glimchb glimchb marked this pull request as ready for review April 12, 2023 02:30
@glimchb glimchb requested a review from a team as a code owner April 12, 2023 02:30
@glimchb glimchb merged commit e04eca8 into opiproject:main Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants