Skip to content

Add Implementation for ListKeyVersions Api and AbstractKVStore tests for the same #8

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

Merged
merged 2 commits into from
Apr 24, 2023

Conversation

G8XSU
Copy link
Collaborator

@G8XSU G8XSU commented Apr 19, 2023

  • Add ListKeyVersions Api Implementation
  • Add ListKeyVersions Api AbstractKVStore Integration Tests

Depends on #5 and #6

@G8XSU G8XSU requested a review from jkczyz April 19, 2023 23:19
.getResult().map(record -> record.into(VssDbRecord.class));

List<KeyValue> keyVersions = vssDbRecords.stream()
.filter(kv -> !GLOBAL_VERSION_KEY.equals(kv.getKey()))
Copy link

Choose a reason for hiding this comment

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

Would this mean the number of entries may be one less than pageSize even though there are pageSize matches when the key prefix is empty? Should we filter at the SQL level instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it can mean number of entries in response can be one less than pageSize.
But that shouldn't be a concern and client should not assume response to contain specific number of entries.
For e.g. max number of results in paginated response can change at anytime with no notice to client.

We already caution against this in api doc in proto:
"Caution: Clients must not assume a specific number of key_versions to be present in a page for paginated response."
Only way to know whether nextPage exists or not is by presence of nextPageToken.

Copy link

Choose a reason for hiding this comment

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

That doesn't answer my second question. :)

Should we filter at the SQL level instead?

Is there a reason not to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no big reason in case of SQL, i can do that. (apart from client/api-expectation and precedent)
It is just something to keep in mind that this operation might not be supported by all KV-database i.e. (list along with key not equals).

Copy link

@jkczyz jkczyz Apr 21, 2023

Choose a reason for hiding this comment

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

That's ok. Feel fee to leave it as is.

@jkczyz
Copy link

jkczyz commented Apr 21, 2023

Could you rebase?

@G8XSU G8XSU force-pushed the keys-summary-impl branch from 1b2cd0b to 97b3b83 Compare April 21, 2023 21:15
@G8XSU
Copy link
Collaborator Author

G8XSU commented Apr 21, 2023

Done

Comment on lines 141 to 145
globalVersion = get(GetObjectRequest.newBuilder()
GetObjectRequest getGlobalVersionRequest = GetObjectRequest.newBuilder()
.setStoreId(storeId)
.setKey(GLOBAL_VERSION_KEY)
.build()).getValue().getVersion();
.build();
globalVersion = get(getGlobalVersionRequest).getValue().getVersion();
Copy link

Choose a reason for hiding this comment

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

Changes here a below belong on the first commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed it 👍

@G8XSU G8XSU force-pushed the keys-summary-impl branch from 97b3b83 to 69fb119 Compare April 21, 2023 23:00
@G8XSU G8XSU merged commit ff4b5fc into lightningdevkit:main Apr 24, 2023
@G8XSU G8XSU mentioned this pull request May 10, 2023
31 tasks
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.

2 participants