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

Method Configure

interop/xds/client/client.go:290–322  ·  view source on GitHub ↗
(_ context.Context, in *testpb.ClientConfigureRequest)

Source from the content-addressed store, hash-verified

288}
289
290func (s *configureService) Configure(_ context.Context, in *testpb.ClientConfigureRequest) (*testpb.ClientConfigureResponse, error) {
291 rpcsToMD := make(map[testpb.ClientConfigureRequest_RpcType][]string)
292 for _, typ := range in.GetTypes() {
293 rpcsToMD[typ] = nil
294 }
295 for _, md := range in.GetMetadata() {
296 typ := md.GetType()
297 strs, ok := rpcsToMD[typ]
298 if !ok {
299 continue
300 }
301 rpcsToMD[typ] = append(strs, md.GetKey(), md.GetValue())
302 }
303 cfgs := make([]*rpcConfig, 0, len(rpcsToMD))
304 for typ, md := range rpcsToMD {
305 var rpcType string
306 switch typ {
307 case testpb.ClientConfigureRequest_UNARY_CALL:
308 rpcType = unaryCall
309 case testpb.ClientConfigureRequest_EMPTY_CALL:
310 rpcType = emptyCall
311 default:
312 return nil, fmt.Errorf("unsupported RPC type: %v", typ)
313 }
314 cfgs = append(cfgs, &rpcConfig{
315 typ: rpcType,
316 md: metadata.Pairs(md...),
317 timeout: in.GetTimeoutSec(),
318 })
319 }
320 rpcCfgs.Store(cfgs)
321 return &testpb.ClientConfigureResponse{}, nil
322}
323
324const (
325 unaryCall string = "UnaryCall"

Callers

nothing calls this directly

Calls 8

PairsFunction · 0.92
GetTypesMethod · 0.80
GetMetadataMethod · 0.65
ErrorfMethod · 0.65
GetTypeMethod · 0.45
GetKeyMethod · 0.45
GetValueMethod · 0.45
GetTimeoutSecMethod · 0.45

Tested by

no test coverage detected