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

Struct lbPicker

balancer/grpclb/grpclb_picker.go:136–144  ·  view source on GitHub ↗

lbPicker does two layers of picks: First layer: roundrobin on all servers in serverList, including drops and backends. - If it picks a drop, the RPC will fail as being dropped. - If it picks a backend, do a second layer pick to pick the real backend. Second layer: roundrobin on all READY backends.

Source from the content-addressed store, hash-verified

134//
135// It's guaranteed that len(serverList) > 0.
136type lbPicker struct {
137 mu sync.Mutex
138 serverList []*lbpb.Server
139 serverListNext int
140 subConns []balancer.SubConn // The subConns that were READY when taking the snapshot.
141 subConnsNext int
142
143 stats *rpcStats
144}
145
146func newLBPicker(serverList []*lbpb.Server, readySCs []balancer.SubConn, stats *rpcStats) *lbPicker {
147 return &lbPicker{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected