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

Vault 1979: Query API for Irrevocable Leases #11607

Merged
merged 28 commits into from
Jun 2, 2021

Conversation

swayne275
Copy link
Contributor

No description provided.

@vercel vercel bot temporarily deployed to Preview – vault May 20, 2021 18:28 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook May 20, 2021 18:28 Inactive
@vercel vercel bot temporarily deployed to Preview – vault May 20, 2021 19:12 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook May 20, 2021 19:12 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook May 20, 2021 20:41 Inactive
@vercel vercel bot temporarily deployed to Preview – vault May 20, 2021 20:41 Inactive
@vercel vercel bot temporarily deployed to Preview – vault May 21, 2021 01:22 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook May 21, 2021 01:22 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook May 21, 2021 01:53 Inactive
@vercel vercel bot temporarily deployed to Preview – vault May 21, 2021 01:53 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook May 21, 2021 16:18 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook May 26, 2021 21:48 Inactive
@vercel vercel bot temporarily deployed to Preview – vault May 26, 2021 21:48 Inactive

// sort the results for consistent API response
sort.Slice(matchingLeases, func(i, j int) bool {
return matchingLeases[i].LeaseID < matchingLeases[j].LeaseID
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is fine, but we could also sort by expiration time then lease id, so the operator can get a sense of how old the oldest irrevocable leases are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah that sounds like a good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Other way around on that sort? I think you want to do it in just one pass with the sort predicate testing expiration time and returning if non-equal, then testing leaseid if the expiration times are equal.

Copy link
Contributor Author

@swayne275 swayne275 Jun 1, 2021

Choose a reason for hiding this comment

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

can you clarify how you'd like this sorted? the current code will display the oldest-expiring leases at the top of the list, and if multiple leases have the same expiration time it will then display them in increasing order by the lease id (a comes before b)

i can certainly do it in one slice sort path, but let's verify how we want the results displayed first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we chatted in slack. sorting is correct, but made more efficient here: 585caea

vault/logical_system_paths.go Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – vault-storybook June 1, 2021 16:57 Inactive
@vercel vercel bot temporarily deployed to Preview – vault June 1, 2021 16:57 Inactive
@swayne275 swayne275 requested a review from sgmiller June 1, 2021 16:57
@vercel vercel bot temporarily deployed to Preview – vault-storybook June 1, 2021 17:02 Inactive
@vercel vercel bot temporarily deployed to Preview – vault June 1, 2021 17:02 Inactive

// sort the results for consistent API response
sort.Slice(matchingLeases, func(i, j int) bool {
return matchingLeases[i].LeaseID < matchingLeases[j].LeaseID
Copy link
Collaborator

Choose a reason for hiding this comment

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

Other way around on that sort? I think you want to do it in just one pass with the sort predicate testing expiration time and returning if non-equal, then testing leaseid if the expiration times are equal.

@vercel vercel bot temporarily deployed to Preview – vault-storybook June 2, 2021 15:43 Inactive
@vercel vercel bot temporarily deployed to Preview – vault June 2, 2021 15:43 Inactive
@swayne275 swayne275 requested a review from sgmiller June 2, 2021 15:44
@swayne275 swayne275 merged commit b56a109 into master Jun 2, 2021
@swayne275 swayne275 deleted the vault-1979_expr-irrevocable-query-api branch June 2, 2021 16:11
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.

3 participants