grpc

package
v3.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ArgoVersionHeader = "argo-version"
)

Variables

View Source
var (
	LastSeenServerVersion                  string
	ErrorTranslationUnaryServerInterceptor = func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
		resp, err = handler(ctx, req)
		return resp, TranslateError(err)
	}
	ErrorTranslationStreamServerInterceptor = func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
		return TranslateError(handler(srv, ss))
	}
)

Functions

func GetVersionHeaderClientUnaryInterceptor added in v3.6.0

func GetVersionHeaderClientUnaryInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

GetVersionHeaderClientUnaryInterceptor returns a new unary client interceptor that extracts the argo-version from the response and sets the global variable LastSeenServerVersion

func IncomingHeaderMatcher added in v3.6.11

func IncomingHeaderMatcher(key string) (string, bool)

func NewMuxHandler added in v3.6.11

func NewMuxHandler(grpcServerHandler http.Handler, httpServerHandler http.Handler) http.Handler

NewMuxHandler returns an HTTP handler that allows serving both gRPC and HTTP requests over the same port, both with and without TLS enabled. From: https://pkg.go.dev/golang.org/x/net@v0.41.0/http2/h2c#NewHandler "If a request is an h2c connection, it's hijacked and redirected to s.ServeConn. Otherwise the returned Handler just forwards requests to h. This works because h2c is designed to be parseable as valid HTTP/1, but ignored by any HTTP server that does not handle h2c. Therefore we leverage the HTTP/1 compatible parts of the Go http library to parse and recognize h2c requests. Once a request is recognized as h2c, we hijack the connection and convert it to an HTTP/2 connection which is understandable to s.ServeConn. (s.ServeConn understands HTTP/2 except for the h2c part of it.)"

func PanicLoggerStreamServerInterceptor

func PanicLoggerStreamServerInterceptor(log *log.Entry) grpc.StreamServerInterceptor

PanicLoggerStreamServerInterceptor returns a new streaming server interceptor for recovering from panics and returning error

func PanicLoggerUnaryServerInterceptor

func PanicLoggerUnaryServerInterceptor(log *log.Entry) grpc.UnaryServerInterceptor

PanicLoggerUnaryServerInterceptor returns a new unary server interceptor for recovering from panics and returning error

func RatelimitStreamServerInterceptor added in v3.4.0

func RatelimitStreamServerInterceptor(ratelimiter limiter.Store) grpc.StreamServerInterceptor

RatelimitStreamServerInterceptor returns a new stream server interceptor that performs rate limiting on the request.

func RatelimitUnaryServerInterceptor added in v3.4.0

func RatelimitUnaryServerInterceptor(ratelimiter limiter.Store) grpc.UnaryServerInterceptor

RatelimitUnaryServerInterceptor returns a new unary server interceptor that performs request rate limiting.

func SetVersionHeaderStreamServerInterceptor added in v3.6.0

func SetVersionHeaderStreamServerInterceptor(version wfv1.Version) grpc.StreamServerInterceptor

SetVersionHeaderStreamServerInterceptor returns a new stream server interceptor that sets the argo-version header

func SetVersionHeaderUnaryServerInterceptor added in v3.6.0

func SetVersionHeaderUnaryServerInterceptor(version wfv1.Version) grpc.UnaryServerInterceptor

SetVersionHeaderUnaryServerInterceptor returns a new unary server interceptor that sets the argo-version header

func TranslateError

func TranslateError(err error) error

translate a K8S errors into gRPC error - assume that we want to surface this - which we may not

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL