feat(Datastore): Swap the default transport from HttpJson to gRPC#12977
feat(Datastore): Swap the default transport from HttpJson to gRPC#12977
Conversation
There was a problem hiding this comment.
Code Review
This pull request transitions the default transport for Datastore from HTTP to gRPC, updating the DatastoreOptions builder and tests. Review feedback identifies several redundant assignments in the Builder class that should be removed to maintain idiomatic patterns and avoid logic errors, specifically in the constructors and the setTransportOptions method.
| this.channelProvider = validateChannelProvider(options.channelProvider); | ||
| this.host = options.getHost(); | ||
| this.transportOptions = options.getTransportOptions(); |
There was a problem hiding this comment.
These assignments are redundant and potentially introduce a bug. The super(options) call already copies the host and transportOptions fields from the provided options object. By calling options.getHost() and options.getTransportOptions(), you are resolving the defaults and storing them as explicit values in the builder. This breaks the toBuilder() pattern where a user might want to change the transport and have the host automatically switch to its corresponding default. Per repository guidelines, reuse pre-configured objects from options classes directly instead of creating new ones and copying settings.
| this.channelProvider = validateChannelProvider(options.channelProvider); | |
| this.host = options.getHost(); | |
| this.transportOptions = options.getTransportOptions(); | |
| this.channelProvider = validateChannelProvider(options.channelProvider); |
References
- Reuse pre-configured objects from options classes directly instead of creating new ones and copying settings.
| this.transportOptions = transportOptions; | ||
| return super.setTransportOptions(transportOptions); |
There was a problem hiding this comment.
The assignment this.transportOptions = transportOptions; is redundant because super.setTransportOptions(transportOptions) already performs this assignment in the base class.
| this.transportOptions = transportOptions; | |
| return super.setTransportOptions(transportOptions); | |
| return super.setTransportOptions(transportOptions); |
No description provided.