SubConnFromPicker returns a function which returns a SubConn by calling the Pick() method of the provided picker. There is no caching of SubConns here. Every invocation of the returned function results in a new pick.
(p balancer.Picker)
| 389 | // Pick() method of the provided picker. There is no caching of SubConns here. |
| 390 | // Every invocation of the returned function results in a new pick. |
| 391 | func SubConnFromPicker(p balancer.Picker) func() balancer.SubConn { |
| 392 | return func() balancer.SubConn { |
| 393 | scst, _ := p.Pick(balancer.PickInfo{}) |
| 394 | return scst.SubConn |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | // ErrTestConstPicker is error returned by test const picker. |
| 399 | var ErrTestConstPicker = fmt.Errorf("const picker error") |