blob: fa25811f3b04d58e7f3d7920c95f2658a79cf195 [file] [log] [blame]
khenaidooac637102019-01-14 15:44:34 -05001// Copyright 2017 The etcd Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package clientv3
16
17import (
18 "math"
19
20 "google.golang.org/grpc"
21)
22
23var (
24 // Disable gRPC internal retrial logic
25 // TODO: enable when gRPC retry is stable (FailFast=false)
26 // Reference:
27 // - https://github.com/grpc/grpc-go/issues/1532
28 // - https://github.com/grpc/proposal/blob/master/A6-client-retries.md
29 defaultFailFast = grpc.FailFast(true)
30
31 // client-side request send limit, gRPC default is math.MaxInt32
32 // Make sure that "client-side send limit < server-side default send/recv limit"
33 // Same value as "embed.DefaultMaxRequestBytes" plus gRPC overhead bytes
34 defaultMaxCallSendMsgSize = grpc.MaxCallSendMsgSize(2 * 1024 * 1024)
35
36 // client-side response receive limit, gRPC default is 4MB
37 // Make sure that "client-side receive limit >= server-side default send/recv limit"
38 // because range response can easily exceed request send limits
39 // Default to math.MaxInt32; writes exceeding server-side send limit fails anyway
40 defaultMaxCallRecvMsgSize = grpc.MaxCallRecvMsgSize(math.MaxInt32)
41)
42
43// defaultCallOpts defines a list of default "gRPC.CallOption".
44// Some options are exposed to "clientv3.Config".
45// Defaults will be overridden by the settings in "clientv3.Config".
46var defaultCallOpts = []grpc.CallOption{defaultFailFast, defaultMaxCallSendMsgSize, defaultMaxCallRecvMsgSize}
47
48// MaxLeaseTTL is the maximum lease TTL value
49const MaxLeaseTTL = 9000000000