-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(Datastore): Swap the default transport from HttpJson to gRPC #12977
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 1 commit
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -131,21 +131,26 @@ public static class Builder extends ServiceOptions.Builder<Datastore, DatastoreO | |||||||||
|
|
||||||||||
| @Nullable private DatastoreOpenTelemetryOptions openTelemetryOptions = null; | ||||||||||
|
|
||||||||||
| private Builder() {} | ||||||||||
| private Builder() { | ||||||||||
| this.transportOptions = new DatastoreDefaults().getDefaultTransportOptions(); | ||||||||||
| } | ||||||||||
|
lqiu96 marked this conversation as resolved.
Outdated
|
||||||||||
|
|
||||||||||
| private Builder(DatastoreOptions options) { | ||||||||||
| super(options); | ||||||||||
| this.namespace = options.namespace; | ||||||||||
| this.databaseId = options.databaseId; | ||||||||||
| this.openTelemetryOptions = options.openTelemetryOptions; | ||||||||||
| this.channelProvider = validateChannelProvider(options.channelProvider); | ||||||||||
| this.host = options.getHost(); | ||||||||||
| this.transportOptions = options.getTransportOptions(); | ||||||||||
|
Comment on lines
147
to
+149
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. These assignments are redundant and potentially introduce a bug. The
Suggested change
References
|
||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public Builder setTransportOptions(TransportOptions transportOptions) { | ||||||||||
| if (!(transportOptions instanceof HttpTransportOptions)) { | ||||||||||
| if (!(transportOptions instanceof HttpTransportOptions) | ||||||||||
| && !(transportOptions instanceof GrpcTransportOptions)) { | ||||||||||
| throw new IllegalArgumentException( | ||||||||||
| "Only http transport is allowed for " + API_SHORT_NAME + "."); | ||||||||||
| "Only http and grpc transport are allowed for " + API_SHORT_NAME + "."); | ||||||||||
| } | ||||||||||
| this.transportOptions = transportOptions; | ||||||||||
| return super.setTransportOptions(transportOptions); | ||||||||||
|
Comment on lines
178
to
179
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. The assignment
Suggested change
|
||||||||||
|
|
@@ -308,8 +313,8 @@ public TransportOptions getDefaultTransportOptions() { | |||||||||
| return TRANSPORT_OPTIONS; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public static HttpTransportOptions.Builder getDefaultTransportOptionsBuilder() { | ||||||||||
| return HttpTransportOptions.newBuilder(); | ||||||||||
| public static GrpcTransportOptions.Builder getDefaultTransportOptionsBuilder() { | ||||||||||
| return GrpcTransportOptions.newBuilder(); | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.