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

Bigtable: Expose the default transport builder #4507

Merged
merged 1 commit into from
Feb 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.api.gax.rpc.ServerStreamingCallSettings;
import com.google.api.gax.rpc.StatusCode.Code;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.bigtable.data.v2.internal.DummyBatchingDescriptor;
import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
Expand Down Expand Up @@ -176,6 +177,19 @@ public String getAppProfileId() {
return appProfileId;
}

/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return BigtableStubSettings.defaultGrpcTransportProviderBuilder()
// TODO: tune channels
.setChannelsPerCpu(2)
.setMaxInboundMessageSize(MAX_MESSAGE_SIZE);
}

@SuppressWarnings("WeakerAccess")
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}

/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return BigtableStubSettings.defaultCredentialsProviderBuilder()
Expand Down Expand Up @@ -260,12 +274,7 @@ private Builder() {
BigtableStubSettings.Builder baseDefaults = BigtableStubSettings.newBuilder();

setEndpoint(baseDefaults.getEndpoint());
setTransportChannelProvider(
InstantiatingGrpcChannelProvider.newBuilder()
// TODO: tune channels
.setChannelsPerCpu(2)
.setMaxInboundMessageSize(MAX_MESSAGE_SIZE)
.build());
setTransportChannelProvider(defaultTransportChannelProvider());
setStreamWatchdogCheckInterval(baseDefaults.getStreamWatchdogCheckInterval());
setStreamWatchdogProvider(baseDefaults.getStreamWatchdogProvider());

Expand Down