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

Function getChainUnaryInvoker

clientconn.go:541–548  ·  view source on GitHub ↗

getChainUnaryInvoker recursively generate the chained unary invoker.

(interceptors []UnaryClientInterceptor, curr int, finalInvoker UnaryInvoker)

Source from the content-addressed store, hash-verified

539
540// getChainUnaryInvoker recursively generate the chained unary invoker.
541func getChainUnaryInvoker(interceptors []UnaryClientInterceptor, curr int, finalInvoker UnaryInvoker) UnaryInvoker {
542 if curr == len(interceptors)-1 {
543 return finalInvoker
544 }
545 return func(ctx context.Context, method string, req, reply any, cc *ClientConn, opts ...CallOption) error {
546 return interceptors[curr+1](ctx, method, req, reply, cc, getChainUnaryInvoker(interceptors, curr+1, finalInvoker), opts...)
547 }
548}
549
550// chainStreamClientInterceptors chains all stream client interceptors into one.
551func chainStreamClientInterceptors(cc *ClientConn) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected