public static class SpannerOptions.Builder extends com.google.cloud.ServiceOptions.Builder<Spanner,SpannerOptions,SpannerOptions.Builder>
SpannerOptions
instances.Modifier and Type | Method and Description |
---|---|
SpannerOptions |
build() |
protected Set<String> |
getAllowedClientLibTokens() |
DatabaseAdminStubSettings.Builder |
getDatabaseAdminStubSettingsBuilder()
Returns the
DatabaseAdminStubSettings.Builder that will be used to build the SpannerRpc . |
InstanceAdminStubSettings.Builder |
getInstanceAdminStubSettingsBuilder()
Returns the
InstanceAdminStubSettings.Builder that will be used to build the SpannerRpc . |
SpannerStubSettings.Builder |
getSpannerStubSettingsBuilder()
Returns the
SpannerStubSettings.Builder that will be used to build the SpannerRpc . |
SpannerOptions.Builder |
setChannelConfigurator(com.google.api.core.ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> channelConfigurator)
Sets an
ApiFunction that will be used to configure the transport channel. |
SpannerOptions.Builder |
setChannelProvider(com.google.api.gax.rpc.TransportChannelProvider channelProvider)
Sets the
ChannelProvider . |
SpannerOptions.Builder |
setInterceptorProvider(com.google.api.gax.grpc.GrpcInterceptorProvider interceptorProvider)
Sets the
GrpcInterceptorProvider . |
SpannerOptions.Builder |
setNumChannels(int numChannels)
Sets the number of gRPC channels to use.
|
SpannerOptions.Builder |
setPartitionedDmlTimeout(org.threeten.bp.Duration timeout)
Sets a timeout specifically for Partitioned DML statements executed through
DatabaseClient.executePartitionedUpdate(Statement) . |
SpannerOptions.Builder |
setPrefetchChunks(int prefetchChunks)
Specifying this will allow the client to prefetch up to
prefetchChunks PartialResultSet chunks for each read and query. |
SpannerOptions.Builder |
setRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings)
SpannerOptions.Builder does not support global retry settings, as it creates three
different gRPC clients: Spanner , DatabaseAdminClient and InstanceAdminClient . |
SpannerOptions.Builder |
setSessionLabels(Map<String,String> sessionLabels)
Sets the labels to add to all Sessions created in this client.
|
SpannerOptions.Builder |
setSessionPoolOption(SessionPoolOptions sessionPoolOptions)
Sets the options for managing the session pool.
|
SpannerOptions.Builder |
setTransportOptions(com.google.cloud.TransportOptions transportOptions) |
public SpannerOptions.Builder setTransportOptions(com.google.cloud.TransportOptions transportOptions)
setTransportOptions
in class com.google.cloud.ServiceOptions.Builder<Spanner,SpannerOptions,SpannerOptions.Builder>
protected Set<String> getAllowedClientLibTokens()
getAllowedClientLibTokens
in class com.google.cloud.ServiceOptions.Builder<Spanner,SpannerOptions,SpannerOptions.Builder>
public SpannerOptions.Builder setChannelProvider(com.google.api.gax.rpc.TransportChannelProvider channelProvider)
ChannelProvider
. GapicSpannerRpc
would create a default one if none
is provided.public SpannerOptions.Builder setChannelConfigurator(com.google.api.core.ApiFunction<ManagedChannelBuilder,ManagedChannelBuilder> channelConfigurator)
ApiFunction
that will be used to configure the transport channel. This will
only be used if no custom TransportChannelProvider
has been set.public SpannerOptions.Builder setInterceptorProvider(com.google.api.gax.grpc.GrpcInterceptorProvider interceptorProvider)
GrpcInterceptorProvider
. GapicSpannerRpc
would create a default one
if none is provided.public SpannerOptions.Builder setNumChannels(int numChannels)
SpannerOptions
.public SpannerOptions.Builder setSessionPoolOption(SessionPoolOptions sessionPoolOptions)
SessionPoolOptions
is used.public SpannerOptions.Builder setSessionLabels(Map<String,String> sessionLabels)
sessionLabels
- Map from label key to label value. Label key and value cannot be null.
For more information on valid syntax see
api docs .public SpannerOptions.Builder setRetrySettings(com.google.api.gax.retrying.RetrySettings retrySettings)
SpannerOptions.Builder
does not support global retry settings, as it creates three
different gRPC clients: Spanner
, DatabaseAdminClient
and InstanceAdminClient
. Instead of calling this method, you should set specific RetrySettings
for each of the underlying gRPC clients by calling respectively getSpannerStubSettingsBuilder()
, getDatabaseAdminStubSettingsBuilder()
or getInstanceAdminStubSettingsBuilder()
.setRetrySettings
in class com.google.cloud.ServiceOptions.Builder<Spanner,SpannerOptions,SpannerOptions.Builder>
public SpannerStubSettings.Builder getSpannerStubSettingsBuilder()
SpannerStubSettings.Builder
that will be used to build the SpannerRpc
. Use this to set custom RetrySettings
for individual gRPC methods.
The library will automatically use the defaults defined in SpannerStubSettings
if
no custom settings are set. The defaults are the same as the defaults that are used by SpannerSettings
, and are generated from the file spanner_gapic.yaml.
Retries are configured for idempotent methods but not for non-idempotent methods.
You can set the same RetrySettings
for all unary methods by calling this:
builder
.getSpannerStubSettingsBuilder()
.applyToAllUnaryMethods(
new ApiFunction<UnaryCallSettings.Builder<?, ?>, Void>() {
public Void apply(Builder<?, ?> input) {
input.setRetrySettings(retrySettings);
return null;
}
});
public InstanceAdminStubSettings.Builder getInstanceAdminStubSettingsBuilder()
InstanceAdminStubSettings.Builder
that will be used to build the SpannerRpc
. Use this to set custom RetrySettings
for individual gRPC methods.
The library will automatically use the defaults defined in InstanceAdminStubSettings
if no custom settings are set. The defaults are the same as the
defaults that are used by InstanceAdminSettings
, and are generated from the file spanner_admin_instance_gapic.yaml.
Retries are configured for idempotent methods but not for non-idempotent methods.
You can set the same RetrySettings
for all unary methods by calling this:
builder
.getInstanceAdminStubSettingsBuilder()
.applyToAllUnaryMethods(
new ApiFunction<UnaryCallSettings.Builder<?, ?>, Void>() {
public Void apply(Builder<?, ?> input) {
input.setRetrySettings(retrySettings);
return null;
}
});
public DatabaseAdminStubSettings.Builder getDatabaseAdminStubSettingsBuilder()
DatabaseAdminStubSettings.Builder
that will be used to build the SpannerRpc
. Use this to set custom RetrySettings
for individual gRPC methods.
The library will automatically use the defaults defined in DatabaseAdminStubSettings
if no custom settings are set. The defaults are the same as the
defaults that are used by DatabaseAdminSettings
, and are generated from the file spanner_admin_database_gapic.yaml.
Retries are configured for idempotent methods but not for non-idempotent methods.
You can set the same RetrySettings
for all unary methods by calling this:
builder
.getDatabaseAdminStubSettingsBuilder()
.applyToAllUnaryMethods(
new ApiFunction<UnaryCallSettings.Builder<?, ?>, Void>() {
public Void apply(Builder<?, ?> input) {
input.setRetrySettings(retrySettings);
return null;
}
});
public SpannerOptions.Builder setPartitionedDmlTimeout(org.threeten.bp.Duration timeout)
DatabaseClient.executePartitionedUpdate(Statement)
. The default is 2 hours.public SpannerOptions.Builder setPrefetchChunks(int prefetchChunks)
prefetchChunks
PartialResultSet
chunks for each read and query. The data size of each chunk depends on the
server implementation but a good rule of thumb is that each chunk will be up to 1 MiB. Larger
values reduce the likelihood of blocking while consuming results at the cost of greater
memory consumption. prefetchChunks
should be greater than 0. To get good performance
choose a value that is large enough to allow buffering of chunks for an entire row. Apart
from the buffered chunks, there can be at most one more row buffered in the client. This can
be overriden on a per read/query basis by Options.prefetchChunks()
. If unspecified,
we will use a default value (currently 4).public SpannerOptions build()
build
in class com.google.cloud.ServiceOptions.Builder<Spanner,SpannerOptions,SpannerOptions.Builder>
Copyright © 2019 Google LLC. All rights reserved.