blob: 79d6e2a984f3d12819e571780fe99a800b3ad51e [file] [log] [blame]
khenaidooac637102019-01-14 15:44:34 -05001// Copyright 2016 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 "context"
19 "crypto/tls"
20 "time"
21
22 "google.golang.org/grpc"
23)
24
25type Config struct {
26 // Endpoints is a list of URLs.
27 Endpoints []string `json:"endpoints"`
28
29 // AutoSyncInterval is the interval to update endpoints with its latest members.
30 // 0 disables auto-sync. By default auto-sync is disabled.
31 AutoSyncInterval time.Duration `json:"auto-sync-interval"`
32
33 // DialTimeout is the timeout for failing to establish a connection.
34 DialTimeout time.Duration `json:"dial-timeout"`
35
36 // DialKeepAliveTime is the time after which client pings the server to see if
37 // transport is alive.
38 DialKeepAliveTime time.Duration `json:"dial-keep-alive-time"`
39
40 // DialKeepAliveTimeout is the time that the client waits for a response for the
41 // keep-alive probe. If the response is not received in this time, the connection is closed.
42 DialKeepAliveTimeout time.Duration `json:"dial-keep-alive-timeout"`
43
44 // MaxCallSendMsgSize is the client-side request send limit in bytes.
45 // If 0, it defaults to 2.0 MiB (2 * 1024 * 1024).
46 // Make sure that "MaxCallSendMsgSize" < server-side default send/recv limit.
47 // ("--max-request-bytes" flag to etcd or "embed.Config.MaxRequestBytes").
48 MaxCallSendMsgSize int
49
50 // MaxCallRecvMsgSize is the client-side response receive limit.
51 // If 0, it defaults to "math.MaxInt32", because range response can
52 // easily exceed request send limits.
53 // Make sure that "MaxCallRecvMsgSize" >= server-side default send/recv limit.
54 // ("--max-request-bytes" flag to etcd or "embed.Config.MaxRequestBytes").
55 MaxCallRecvMsgSize int
56
57 // TLS holds the client secure credentials, if any.
58 TLS *tls.Config
59
60 // Username is a user name for authentication.
61 Username string `json:"username"`
62
63 // Password is a password for authentication.
64 Password string `json:"password"`
65
66 // RejectOldCluster when set will refuse to create a client against an outdated cluster.
67 RejectOldCluster bool `json:"reject-old-cluster"`
68
69 // DialOptions is a list of dial options for the grpc client (e.g., for interceptors).
70 DialOptions []grpc.DialOption
71
72 // Context is the default client context; it can be used to cancel grpc dial out and
73 // other operations that do not have an explicit context.
74 Context context.Context
75}