Skip to content

Conversation

@kyleterry
Copy link
Contributor

To make iterating over pages of nodes easier and consistent, I added a pagination cursor that allows a user of the nodes client to call NodesCursor.Next() to keep fetching pages until an io.EOF error is returned. This keeps the client use minimal of implementing packages (such as scarp) and centralizes and hides the pagination state/logic so it doesn't need to be implemented over and over again.

I think we should generalize this a bit more and add it to all the pdb calls we export in this package as clients. I'm not sure if we can generalize it for the entire go-pe-client tree because other pagination schemes across PE might be different than pdb's API.

To make iterating over pages of nodes easier and consistent, I added a
pagination cursor that allows a user of the nodes client to call
NodesCursor.Next() to keep fetching pages until an io.EOF error is
returned. This keeps the client use minimal of implementing packages
(such as scarp) and centralizes and hides the pagination state/logic so
it doesn't need to be implemented over and over again.

I think we should generalize this a bit more and add it to all the pdb
calls we export in this package as clients. I'm not sure if we can
generalize it for the entire go-pe-client tree because other pagination
schemes across PE might be different than pdb's API.
@kyleterry kyleterry requested a review from a team as a code owner April 5, 2023 21:43
@kyleterry kyleterry requested review from cliveweir and danielkee April 5, 2023 21:43
If the pagination parameter passed to client.PaginatedNodes is nil, then
we create a default one with a limit of 100 set.
@kyleterry kyleterry merged commit ebdd3c5 into master Apr 6, 2023
@kyleterry kyleterry deleted the cisc-3104-nodes-paging-improvements branch April 6, 2023 18:13
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.

4 participants