MCPcopy
hub / github.com/grpc/grpc-go / SubConnFromPicker

Function SubConnFromPicker

internal/testutils/balancer.go:391–396  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
391func 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.
399var ErrTestConstPicker = fmt.Errorf("const picker error")

Calls 1

PickMethod · 0.65