| 40 | type rpcBehaviorBB struct{} |
| 41 | |
| 42 | func (rpcBehaviorBB) Build(cc balancer.ClientConn, bOpts balancer.BuildOptions) balancer.Balancer { |
| 43 | b := &rpcBehaviorLB{ |
| 44 | ClientConn: cc, |
| 45 | } |
| 46 | // round_robin child to complete balancer tree with a usable leaf policy and |
| 47 | // have RPCs actually work. |
| 48 | builder := balancer.Get(roundrobin.Name) |
| 49 | if builder == nil { |
| 50 | // Shouldn't happen, defensive programming. Registered from import of |
| 51 | // roundrobin package. |
| 52 | return nil |
| 53 | } |
| 54 | rr := builder.Build(b, bOpts) |
| 55 | if rr == nil { |
| 56 | // Shouldn't happen, defensive programming. |
| 57 | return nil |
| 58 | } |
| 59 | b.Balancer = rr |
| 60 | return b |
| 61 | } |
| 62 | |
| 63 | func (rpcBehaviorBB) ParseConfig(s json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { |
| 64 | lbCfg := &lbConfig{} |