diff --git a/clientv3/client.go b/clientv3/client.go index ef5e7ea24..71492b422 100644 --- a/clientv3/client.go +++ b/clientv3/client.go @@ -76,8 +76,8 @@ type Client struct { // New creates a new etcdv3 client from a given configuration. func New(cfg Config) (*Client, error) { - if cfg.RetryDialer == nil { - cfg.RetryDialer = dialEndpointList + if cfg.retryDialer == nil { + cfg.retryDialer = dialEndpointList } if len(cfg.Endpoints) == 0 { return nil, ErrNoAvailableEndpoints @@ -227,7 +227,7 @@ func WithRequireLeader(ctx context.Context) context.Context { func newClient(cfg *Config) (*Client, error) { if cfg == nil { - cfg = &Config{RetryDialer: dialEndpointList} + cfg = &Config{retryDialer: dialEndpointList} } var creds *credentials.TransportAuthenticator if cfg.TLS != nil { @@ -237,7 +237,7 @@ func newClient(cfg *Config) (*Client, error) { // use a temporary skeleton client to bootstrap first connection ctx, cancel := context.WithCancel(context.TODO()) - conn, err := cfg.RetryDialer(&Client{cfg: *cfg, creds: creds, ctx: ctx, Username: cfg.Username, Password: cfg.Password}) + conn, err := cfg.retryDialer(&Client{cfg: *cfg, creds: creds, ctx: ctx, Username: cfg.Username, Password: cfg.Password}) if err != nil { return nil, err } @@ -301,7 +301,7 @@ func (c *Client) retryConnection(err error) (newConn *grpc.ClientConn, dialErr e return nil, c.ctx.Err() } - c.conn, dialErr = c.cfg.RetryDialer(c) + c.conn, dialErr = c.cfg.retryDialer(c) if dialErr != nil { c.errors = append(c.errors, dialErr) } diff --git a/clientv3/config.go b/clientv3/config.go index aecbbd9af..050ce1ce6 100644 --- a/clientv3/config.go +++ b/clientv3/config.go @@ -32,8 +32,9 @@ type Config struct { // Endpoints is a list of URLs Endpoints []string - // RetryDialer chooses the next endpoint to use - RetryDialer EndpointDialer + // retryDialer chooses the next endpoint to use + // keep private until the grpc rebalancer is sorted out + retryDialer EndpointDialer // DialTimeout is the timeout for failing to establish a connection. DialTimeout time.Duration