-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(storage): add object contexts in Go GCS SDK #13390
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?
Conversation
Summary of ChangesHello @krishnamd-jkp, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Go Google Cloud Storage SDK by introducing support for object contexts. This new feature allows users to associate custom key-value metadata with their objects, providing a flexible way to annotate and categorize data. Furthermore, it enables powerful filtering capabilities during object listing, allowing users to retrieve objects based on the presence, absence, or specific values of these custom contexts. The changes involve new data structures, conversion logic, and integration into existing client operations like create, update, copy, compose, and list. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
4dd141c to
9908107
Compare
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.
Code Review
This pull request introduces support for object contexts in the Go GCS SDK, a significant feature enhancement. The changes include new types for object contexts, conversion functions for different API layers (raw/HTTP and proto/gRPC), and updates to client methods to handle these contexts. Extensive integration tests have been added to cover various scenarios like creation, patching, copying, and listing objects with contexts. The implementation is mostly solid, but I've identified a critical bug in filter string construction and an incorrect test case for object composition. I've also included several suggestions to improve code clarity and test robustness.
81f93e5 to
3d0bfce
Compare
3d0bfce to
a996350
Compare
cpriti-os
left a comment
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.
Changes requested.
| } | ||
| } | ||
|
|
||
| func toStringCustomContext(cc *CustomContext) string { |
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.
This has a bit of a smell to me. Is it a requirement to make a CustomContext type in each language which does this sort of cleverness? Or would it be easier to just expose Filter directly as a field on Query and allow the user to construct the appropriate filter string themself?
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.
I introduced this to just make it user friendly. It wouldn't be user friendly to expect users to give the string themselves, would it? Given it has unintuitive format like providing "-" for negation, "key=value", "key:*" etc.
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.
I think the place to introduce this kind of a structured format would generally be in the proto message definition rather than in the SDKs. Can you check how this is implemented in other languages and/or check in with the team doing the API launch to see what they 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.
The Java API looks like it's just using filter as a text field directly so IMO it's also fine to do that in Go https://github.com/googleapis/java-storage/pull/3329/files#diff-20bcaa643fb27f1cb3b69cd788ade6590ecec05456217cc7103513ca3a89ba94
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.
+1, this should not be part of SDK and it adds unnecessary maintenance burden.
storage/grpc_client.go
Outdated
| } | ||
| } | ||
|
|
||
| if uattrs.Contexts != nil { |
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.
Would be better to use helper function here and in http_client.go to keep UpdateObject method clean and modular?
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.
The update logic is different for gRPC and HTTP. I think it's okay as it again follows other metadata fields
No description provided.