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

Method Build

interop/xds/custom_lb.go:42–61  ·  view source on GitHub ↗
(cc balancer.ClientConn, bOpts balancer.BuildOptions)

Source from the content-addressed store, hash-verified

40type rpcBehaviorBB struct{}
41
42func (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
63func (rpcBehaviorBB) ParseConfig(s json.RawMessage) (serviceconfig.LoadBalancingConfig, error) {
64 lbCfg := &lbConfig{}

Callers

nothing calls this directly

Calls 2

GetFunction · 0.92
BuildMethod · 0.65

Tested by

no test coverage detected