grpc

package
v0.0.0-...-d945414 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDeadline

func CopyDeadline(ctx context.Context) (context.Context, context.CancelFunc)

CopyDeadline searches for the deadline in the metadata and returns an updated context with a cancellation function. If the headers do not include the deadline value, the context is returned unchanged and the cancellation function will be nil.

func ExtractMetadata

func ExtractMetadata(ctx context.Context) context.Context

ExtractMetadata extracts configured values from the metadata and stores them in the returned context.

func UnaryClientIntercept

func UnaryClientIntercept(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

UnaryClientIntercept intercepts an outgoing request, adding metadata keys for the configured context values and deadline.

func UnaryServerInterceptor

func UnaryServerInterceptor(ctx context.Context, r any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

UnaryServerInterceptor extracts configured values from the incoming metadata and stores them in the context. Sets a deadline (and handles its cancellation) when one is found. Does not process outgoing metadata.

Types

This section is empty.

Jump to

Keyboard shortcuts

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