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

feat: adding utility to transform protobuf into model object #299

Merged
merged 5 commits into from May 14, 2020

Conversation

rahulKQL
Copy link
Contributor

Fixes #297

With this commit, the User shall be able to transform protobuf object to bigtable client's specific model objects.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

With this commit, User shall be able to transform protobuf object to bigtable client's specific model objects.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 11, 2020
@codecov
Copy link

codecov bot commented May 11, 2020

Codecov Report

Merging #299 into master will increase coverage by 0.47%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #299      +/-   ##
============================================
+ Coverage     79.51%   79.98%   +0.47%     
- Complexity      991      998       +7     
============================================
  Files            99       99              
  Lines          6444     6466      +22     
  Branches        318      340      +22     
============================================
+ Hits           5124     5172      +48     
+ Misses         1119     1115       -4     
+ Partials        201      179      -22     
Impacted Files Coverage Δ Complexity Δ
...le/cloud/bigtable/data/v2/models/BulkMutation.java 100.00% <100.00%> (ø) 11.00 <1.00> (+1.00)
...igtable/data/v2/models/ConditionalRowMutation.java 97.50% <100.00%> (+0.35%) 12.00 <1.00> (+1.00)
...google/cloud/bigtable/data/v2/models/Mutation.java 87.09% <100.00%> (+0.43%) 28.00 <1.00> (+1.00)
...ud/bigtable/data/v2/models/ReadModifyWriteRow.java 98.00% <100.00%> (+2.34%) 11.00 <1.00> (+2.00)
...gle/cloud/bigtable/data/v2/models/RowMutation.java 71.42% <100.00%> (+1.61%) 13.00 <1.00> (+1.00)
...ud/bigtable/data/v2/stub/EnhancedBigtableStub.java 95.26% <0.00%> (+0.08%) 21.00% <0.00%> (+1.00%)
...om/google/cloud/bigtable/emulator/v2/Emulator.java 59.13% <0.00%> (+2.60%) 14.00% <0.00%> (ø%)
...able/admin/v2/BaseBigtableInstanceAdminClient.java 61.46% <0.00%> (+4.39%) 56.00% <0.00%> (ø%)
...igtable/admin/v2/BaseBigtableTableAdminClient.java 62.90% <0.00%> (+4.72%) 67.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4374492...1e680e8. Read the comment docs.

 - updated the JavaDoc
 - marked the utility as `@BetaApi`
* BigtableDataClient. The mutation must always be idempotent because it would be retried.
*/
@BetaApi
public static ConditionalRowMutation fromProtobuf(@Nonnull CheckAndMutateRowRequest request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and everywhere else, please stay consistent with existing fromProto methods

 - Rephrased Javadoc to include more explanation
 - change `Mutation#fromProto` visibility to package only
As Mutation#fromProto is being used by RowMutation#fromProto, So removed `@VisibleForTesting` annotation
Copy link
Contributor

@igorbernstein2 igorbernstein2 left a comment

Choose a reason for hiding this comment

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

LGTM, but please extend the tests to make sure that project & instance get overwritten by the request context

@rahulKQL rahulKQL merged commit 00f6d2d into googleapis:master May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create fromProtobuf utility method in existing models
3 participants