-
Notifications
You must be signed in to change notification settings - Fork 23
Paginate by creation time instead of key order #96
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,14 +210,16 @@ message ListKeyVersionsRequest { | |
| // Server response for `ListKeyVersions` API. | ||
| message ListKeyVersionsResponse { | ||
|
|
||
| // Fetched keys and versions. | ||
| // Fetched keys and versions, ordered by creation time (newest first). | ||
| // Even though this API reuses the `KeyValue` struct, the `value` sub-field will not be set by the server. | ||
| repeated KeyValue key_versions = 1; | ||
|
|
||
| // `next_page_token` is a pagination token, used to retrieve the next page of results. | ||
| // Use this value to query for next-page of paginated `ListKeyVersions` operation, by specifying | ||
| // this value as the `page_token` in the next request. | ||
| // | ||
| // Following AIP-158 (https://google.aip.dev/158): | ||
| // | ||
| // If `next_page_token` is empty (""), then the "last page" of results has been processed and | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I think we were intentionally following protobuf's/Google's best practices here. https://google.aip.dev/158 states:
IMO would be good to revert and include this context in the docs.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay updated |
||
| // there is no more data to be retrieved. | ||
| // | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remind me, is there any particular reason we need to use time for this? Wouldn't we get around the need for a tie breaker if we'd simply use a monotonically increasing atomic counter instead (e.g., a Postgres
BIGSERIALcolumn) ? Then we'd be certain than each entry has a unique value?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you tnull for raising this point. I did some back-and-forth with claude, and yea this is interesting !
My one question at this point is backwards compat. Do you have thoughts on this point ? I'm thinking if keys created before this commit don't have strict creation order, this is OK. Perhaps we can use the VSS version you described above to encourage people to upgrade once we start relying on
PaginatedKVStorein LDK Node.@benthecarman let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tnull I ping you on the response above in case it helps bubble this up in your inbox :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't know we could use
BIGSERIALfor non-primary keys (in sqlite you can't).Yeah this might be better. On backwards compat, we still should be able to backfill the column by sorting by creation time, however, the migration that claude generated for this is pretty big/ugly.