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

Paginate ListPipeline gRPC [CORE-2133] #9825

Merged
merged 8 commits into from Mar 14, 2024
Merged

Conversation

acohen4
Copy link
Contributor

@acohen4 acohen4 commented Mar 11, 2024

No description provided.

@acohen4 acohen4 requested review from a team as code owners March 11, 2024 11:39
@acohen4 acohen4 changed the title Paginate ListPipeline gRPC Paginate ListPipeline gRPC [CORE-2133] Mar 11, 2024
src/server/pps/server/api_server.go Outdated Show resolved Hide resolved

// Page indicates which page of a certain size to return. If page is left empty,
// all of the selected pipelines will be returned.
PipelinePage page = 7;
Copy link
Contributor

Choose a reason for hiding this comment

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

If it’s not too late, I think it might be a good idea to reconsider some of the names here. Is this a pipeline page, or is this a definition or request or specification for a pipeline page?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually like the name page here. It's clear and short. What would you call it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe PageSpec? Not a huge deal, I just found an earlier version of the code a little surprising to read. But this right now seems okay:

offset = request.Page.PageIndex * request.Page.PageSize

src/server/pps/server/api_server.go Outdated Show resolved Hide resolved
src/server/pps/server/api_server.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kevyang kevyang left a comment

Choose a reason for hiding this comment

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

rubber stamp for integrations (there is only generated code for the sdk)

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.92%. Comparing base (ad14264) to head (cff12d2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9825      +/-   ##
==========================================
- Coverage   58.93%   58.92%   -0.01%     
==========================================
  Files         586      586              
  Lines       70673    70683      +10     
==========================================
- Hits        41653    41652       -1     
- Misses      28487    28499      +12     
+ Partials      533      532       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -3012,12 +3012,21 @@ func (a *apiServer) listPipeline(ctx context.Context, request *pps.ListPipelineR
})
})
}
var offset int64
if request.Page != nil {
offset = request.Page.PageIndex * request.Page.PageSize
Copy link
Contributor

Choose a reason for hiding this comment

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

You can reduce this whole var … if … { … } to offset := request.GetPage().GetPageIndex() * request.GetPage().GetPageSize(). It is mildly ugly to call request.GetPage twice, but it’s not the end of the world, and you could always assign it to a variable if you like, and then use that variable down at line 3,027.

@acohen4 acohen4 merged commit 44a2515 into master Mar 14, 2024
21 checks passed
@acohen4 acohen4 deleted the acohen4/paginate-pipelines branch March 14, 2024 13:56
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.

None yet

3 participants