gRPC migration
Change-Id: Ib390f6dde0d5a8d6db12ccd7da41135570ad1354
diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
index d4d6455..29f7a4d 100644
--- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
+++ b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
@@ -22,12 +22,14 @@
package roundrobin
import (
+ "context"
"sync"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/balancer/base"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal/grpcrand"
+ "google.golang.org/grpc/resolver"
)
// Name is the name of round_robin balancer.
@@ -35,7 +37,7 @@
// newBuilder creates a new roundrobin balancer builder.
func newBuilder() balancer.Builder {
- return base.NewBalancerBuilderV2(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true})
+ return base.NewBalancerBuilderWithConfig(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true})
}
func init() {
@@ -44,13 +46,13 @@
type rrPickerBuilder struct{}
-func (*rrPickerBuilder) Build(info base.PickerBuildInfo) balancer.V2Picker {
- grpclog.Infof("roundrobinPicker: newPicker called with info: %v", info)
- if len(info.ReadySCs) == 0 {
- return base.NewErrPickerV2(balancer.ErrNoSubConnAvailable)
+func (*rrPickerBuilder) Build(readySCs map[resolver.Address]balancer.SubConn) balancer.Picker {
+ grpclog.Infof("roundrobinPicker: newPicker called with readySCs: %v", readySCs)
+ if len(readySCs) == 0 {
+ return base.NewErrPicker(balancer.ErrNoSubConnAvailable)
}
var scs []balancer.SubConn
- for sc := range info.ReadySCs {
+ for _, sc := range readySCs {
scs = append(scs, sc)
}
return &rrPicker{
@@ -72,10 +74,10 @@
next int
}
-func (p *rrPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) {
+func (p *rrPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) {
p.mu.Lock()
sc := p.subConns[p.next]
p.next = (p.next + 1) % len(p.subConns)
p.mu.Unlock()
- return balancer.PickResult{SubConn: sc}, nil
+ return sc, nil, nil
}