|
|
@@ -60,7 +60,6 @@ type dialOptions struct {
|
|
|
balancerBuilder balancer.Builder
|
|
|
// This is to support grpclb.
|
|
|
resolverBuilder resolver.Builder
|
|
|
- reqHandshake envconfig.RequireHandshakeSetting
|
|
|
channelzParentID int64
|
|
|
disableServiceConfig bool
|
|
|
disableRetry bool
|
|
|
@@ -100,17 +99,6 @@ func newFuncDialOption(f func(*dialOptions)) *funcDialOption {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// WithWaitForHandshake blocks until the initial settings frame is received from
|
|
|
-// the server before assigning RPCs to the connection.
|
|
|
-//
|
|
|
-// Deprecated: this is the default behavior, and this option will be removed
|
|
|
-// after the 1.18 release.
|
|
|
-func WithWaitForHandshake() DialOption {
|
|
|
- return newFuncDialOption(func(o *dialOptions) {
|
|
|
- o.reqHandshake = envconfig.RequireHandshakeOn
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
// WithWriteBufferSize determines how much data can be batched before doing a
|
|
|
// write on the wire. The corresponding memory allocation for this buffer will
|
|
|
// be twice the size to keep syscalls low. The default value for this buffer is
|
|
|
@@ -156,7 +144,8 @@ func WithInitialConnWindowSize(s int32) DialOption {
|
|
|
// WithMaxMsgSize returns a DialOption which sets the maximum message size the
|
|
|
// client can receive.
|
|
|
//
|
|
|
-// Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead.
|
|
|
+// Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead. Will
|
|
|
+// be supported throughout 1.x.
|
|
|
func WithMaxMsgSize(s int) DialOption {
|
|
|
return WithDefaultCallOptions(MaxCallRecvMsgSize(s))
|
|
|
}
|
|
|
@@ -172,7 +161,8 @@ func WithDefaultCallOptions(cos ...CallOption) DialOption {
|
|
|
// WithCodec returns a DialOption which sets a codec for message marshaling and
|
|
|
// unmarshaling.
|
|
|
//
|
|
|
-// Deprecated: use WithDefaultCallOptions(ForceCodec(_)) instead.
|
|
|
+// Deprecated: use WithDefaultCallOptions(ForceCodec(_)) instead. Will be
|
|
|
+// supported throughout 1.x.
|
|
|
func WithCodec(c Codec) DialOption {
|
|
|
return WithDefaultCallOptions(CallCustomCodec(c))
|
|
|
}
|
|
|
@@ -181,7 +171,7 @@ func WithCodec(c Codec) DialOption {
|
|
|
// message compression. It has lower priority than the compressor set by the
|
|
|
// UseCompressor CallOption.
|
|
|
//
|
|
|
-// Deprecated: use UseCompressor instead.
|
|
|
+// Deprecated: use UseCompressor instead. Will be supported throughout 1.x.
|
|
|
func WithCompressor(cp Compressor) DialOption {
|
|
|
return newFuncDialOption(func(o *dialOptions) {
|
|
|
o.cp = cp
|
|
|
@@ -196,7 +186,8 @@ func WithCompressor(cp Compressor) DialOption {
|
|
|
// message. If no compressor is registered for the encoding, an Unimplemented
|
|
|
// status error will be returned.
|
|
|
//
|
|
|
-// Deprecated: use encoding.RegisterCompressor instead.
|
|
|
+// Deprecated: use encoding.RegisterCompressor instead. Will be supported
|
|
|
+// throughout 1.x.
|
|
|
func WithDecompressor(dc Decompressor) DialOption {
|
|
|
return newFuncDialOption(func(o *dialOptions) {
|
|
|
o.dc = dc
|
|
|
@@ -207,7 +198,7 @@ func WithDecompressor(dc Decompressor) DialOption {
|
|
|
// Name resolver will be ignored if this DialOption is specified.
|
|
|
//
|
|
|
// Deprecated: use the new balancer APIs in balancer package and
|
|
|
-// WithBalancerName.
|
|
|
+// WithBalancerName. Will be removed in a future 1.x release.
|
|
|
func WithBalancer(b Balancer) DialOption {
|
|
|
return newFuncDialOption(func(o *dialOptions) {
|
|
|
o.balancerBuilder = &balancerWrapperBuilder{
|
|
|
@@ -223,7 +214,8 @@ func WithBalancer(b Balancer) DialOption {
|
|
|
// The balancer cannot be overridden by balancer option specified by service
|
|
|
// config.
|
|
|
//
|
|
|
-// This is an EXPERIMENTAL API.
|
|
|
+// Deprecated: use WithDefaultServiceConfig and WithDisableServiceConfig
|
|
|
+// instead. Will be removed in a future 1.x release.
|
|
|
func WithBalancerName(balancerName string) DialOption {
|
|
|
builder := balancer.Get(balancerName)
|
|
|
if builder == nil {
|
|
|
@@ -244,9 +236,10 @@ func withResolverBuilder(b resolver.Builder) DialOption {
|
|
|
// WithServiceConfig returns a DialOption which has a channel to read the
|
|
|
// service configuration.
|
|
|
//
|
|
|
-// Deprecated: service config should be received through name resolver, as
|
|
|
-// specified here.
|
|
|
-// https://github.com/grpc/grpc/blob/master/doc/service_config.md
|
|
|
+// Deprecated: service config should be received through name resolver or via
|
|
|
+// WithDefaultServiceConfig, as specified at
|
|
|
+// https://github.com/grpc/grpc/blob/master/doc/service_config.md. Will be
|
|
|
+// removed in a future 1.x release.
|
|
|
func WithServiceConfig(c <-chan ServiceConfig) DialOption {
|
|
|
return newFuncDialOption(func(o *dialOptions) {
|
|
|
o.scChan = c
|
|
|
@@ -329,7 +322,8 @@ func WithCredentialsBundle(b credentials.Bundle) DialOption {
|
|
|
// WithTimeout returns a DialOption that configures a timeout for dialing a
|
|
|
// ClientConn initially. This is valid if and only if WithBlock() is present.
|
|
|
//
|
|
|
-// Deprecated: use DialContext and context.WithTimeout instead.
|
|
|
+// Deprecated: use DialContext and context.WithTimeout instead. Will be
|
|
|
+// supported throughout 1.x.
|
|
|
func WithTimeout(d time.Duration) DialOption {
|
|
|
return newFuncDialOption(func(o *dialOptions) {
|
|
|
o.timeout = d
|
|
|
@@ -356,7 +350,8 @@ func init() {
|
|
|
// is returned by f, gRPC checks the error's Temporary() method to decide if it
|
|
|
// should try to reconnect to the network address.
|
|
|
//
|
|
|
-// Deprecated: use WithContextDialer instead
|
|
|
+// Deprecated: use WithContextDialer instead. Will be supported throughout
|
|
|
+// 1.x.
|
|
|
func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption {
|
|
|
return WithContextDialer(
|
|
|
func(ctx context.Context, addr string) (net.Conn, error) {
|
|
|
@@ -480,8 +475,10 @@ func WithDisableServiceConfig() DialOption {
|
|
|
|
|
|
// WithDefaultServiceConfig returns a DialOption that configures the default
|
|
|
// service config, which will be used in cases where:
|
|
|
-// 1. WithDisableServiceConfig is called.
|
|
|
-// 2. Resolver does not return service config or if the resolver gets and invalid config.
|
|
|
+//
|
|
|
+// 1. WithDisableServiceConfig is also used.
|
|
|
+// 2. Resolver does not return a service config or if the resolver returns an
|
|
|
+// invalid service config.
|
|
|
//
|
|
|
// This API is EXPERIMENTAL.
|
|
|
func WithDefaultServiceConfig(s string) DialOption {
|
|
|
@@ -537,7 +534,6 @@ func withHealthCheckFunc(f internal.HealthChecker) DialOption {
|
|
|
func defaultDialOptions() dialOptions {
|
|
|
return dialOptions{
|
|
|
disableRetry: !envconfig.Retry,
|
|
|
- reqHandshake: envconfig.RequireHandshake,
|
|
|
healthCheckFunc: internal.HealthCheckFunc,
|
|
|
copts: transport.ConnectOptions{
|
|
|
WriteBufferSize: defaultWriteBufSize,
|