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

api: apply consistent behaviour of the reverse query parameter #12244

Merged
merged 8 commits into from
Mar 12, 2022

Conversation

lgfa29
Copy link
Contributor

@lgfa29 lgfa29 commented Mar 9, 2022

The reverse query parameter uses GetReverse to traverse the go-memdb table in the opposite order. Initially (#12186) this was used to return results in ascending or descending chronological order, but since this was only possible in some situations where the table schema allowed the reverse query parameter would only work in some specific combination of query parameters.

Given that there is no inherit meaning in using Get or GetReverse (they are just opposite orders to traverse results) the reverse query parameter can actually be used in most situations.

This PR adds the sort argument to state store functions used by the list endpoints that have been updated so far. If sort is SortReverse, the GetReverse method is used and results are returned in the reverse order from the default.

No changelog required since it's continuation of #12186.

Copy link
Member

@shoenig shoenig left a comment

Choose a reason for hiding this comment

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

LGTM!

@shoenig
Copy link
Member

shoenig commented Mar 11, 2022

I assume that CSI test is unrelated, but might want to rebase on main just in case

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 11, 2022

CLA assistant check
All committers have signed the CLA.

@lgfa29
Copy link
Contributor Author

lgfa29 commented Mar 11, 2022

I assume that CSI test is unrelated, but might want to rebase on main just in case

Ah yeah, it was fixed here: #12245

Rebased just in case to double-check.

@lgfa29 lgfa29 merged commit ddbbda6 into main Mar 12, 2022
@lgfa29 lgfa29 deleted the f-api-consistent-sort branch March 12, 2022 00:44
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/api HTTP API and SDK issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants