From d6287924dee3c5bf38aa5facc81883fb4bebe19a Mon Sep 17 00:00:00 2001 From: EDDYCJY <313687982@qq.com> Date: Wed, 29 Jan 2020 14:35:35 +0800 Subject: [PATCH] clientv3: fix grpc-go(v1.27.0) incompatible changes to balancer/resolver. --- clientv3/balancer/picker/err.go | 2 +- clientv3/balancer/picker/roundrobin_balanced.go | 2 +- clientv3/balancer/resolver/endpoint/endpoint.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clientv3/balancer/picker/err.go b/clientv3/balancer/picker/err.go index 9e043789c8d..f4b941d6529 100644 --- a/clientv3/balancer/picker/err.go +++ b/clientv3/balancer/picker/err.go @@ -34,6 +34,6 @@ func (ep *errPicker) String() string { return ep.p.String() } -func (ep *errPicker) Pick(context.Context, balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (ep *errPicker) Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) { return nil, nil, ep.err } diff --git a/clientv3/balancer/picker/roundrobin_balanced.go b/clientv3/balancer/picker/roundrobin_balanced.go index 1b8b2857378..e3971ecc421 100644 --- a/clientv3/balancer/picker/roundrobin_balanced.go +++ b/clientv3/balancer/picker/roundrobin_balanced.go @@ -52,7 +52,7 @@ type rrBalanced struct { func (rb *rrBalanced) String() string { return rb.p.String() } // Pick is called for every client request. -func (rb *rrBalanced) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { +func (rb *rrBalanced) Pick(ctx context.Context, opts balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) { rb.mu.RLock() n := len(rb.scs) rb.mu.RUnlock() diff --git a/clientv3/balancer/resolver/endpoint/endpoint.go b/clientv3/balancer/resolver/endpoint/endpoint.go index 864b5df6426..2837bd4180b 100644 --- a/clientv3/balancer/resolver/endpoint/endpoint.go +++ b/clientv3/balancer/resolver/endpoint/endpoint.go @@ -111,7 +111,7 @@ func (e *ResolverGroup) Close() { } // Build creates or reuses an etcd resolver for the etcd cluster name identified by the authority part of the target. -func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { +func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { if len(target.Authority) < 1 { return nil, fmt.Errorf("'etcd' target scheme requires non-empty authority identifying etcd cluster being routed to") } @@ -179,7 +179,7 @@ func epsToAddrs(eps ...string) (addrs []resolver.Address) { return addrs } -func (*Resolver) ResolveNow(o resolver.ResolveNowOption) {} +func (*Resolver) ResolveNow(o resolver.ResolveNowOptions) {} func (r *Resolver) Close() { es, err := bldr.getResolverGroup(r.endpointID)