Documentation
¶
Index ¶
- func CanonicalMeta(ctx context.Context, name string) (string, bool)
- func ContextStreamClientInterceptor(modifier OutgoingContextModifier) grpc.StreamClientInterceptor
- func ContextStreamServerInterceptor(modifier IncomingContextModifier) grpc.StreamServerInterceptor
- func ContextUnaryClientInterceptor(modifier OutgoingContextModifier) grpc.UnaryClientInterceptor
- func ContextUnaryServerInterceptor(modifier IncomingContextModifier) grpc.UnaryServerInterceptor
- func ForkContext(ctx, parent context.Context) context.Context
- func ForkOneKey(key any, child, parent context.Context) context.Context
- func ForkedBackgroundWithMeta(ctx context.Context) context.Context
- func Get[T any](ctx context.Context, key any, out *T) bool
- func HttpContextMiddleware(modifier IncomingContextModifier) func(http.Handler) http.Handler
- func MetaKeysIncomingContext(ctx context.Context, prefix string) (context.Context, bool, error)
- func MetaStreamClientInterceptor(prefix string) grpc.StreamClientInterceptor
- func MetaUnaryClientInterceptor(prefix string) grpc.UnaryClientInterceptor
- func MinioMetaFromContext(ctx context.Context, userKey string, forEvents ...bool) (md map[string]string, ok bool)
- func MustWithHint[T any](ctx context.Context, key any, hint string) T
- func NewContext(ctx context.Context, md map[string]string) context.Context
- func RegisterContextInjector(injector ContextInjector)
- func RegisterKeyInjector[T any](key any)
- func With[T any](ctx context.Context, key any, t T) context.Context
- func WithAdditionalMetadata(ctx context.Context, meta map[string]string) context.Context
- func WithUserNameMetadata(ctx context.Context, userKey string, userName string) context.Context
- type ContextInjector
- type IncomingContextModifier
- type Metadata
- type OutgoingContextModifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalMeta ¶
CanonicalMeta extract header name or its lowercase version
func ContextStreamClientInterceptor ¶
func ContextStreamClientInterceptor(modifier OutgoingContextModifier) grpc.StreamClientInterceptor
ContextStreamClientInterceptor is a grpc client middleware to modify context
func ContextStreamServerInterceptor ¶
func ContextStreamServerInterceptor(modifier IncomingContextModifier) grpc.StreamServerInterceptor
ContextStreamServerInterceptor wraps an IncomingContextModifier to create a grpc.StreamServerInterceptor.
func ContextUnaryClientInterceptor ¶
func ContextUnaryClientInterceptor(modifier OutgoingContextModifier) grpc.UnaryClientInterceptor
ContextUnaryClientInterceptor is a grpc client middleware to modify context
func ContextUnaryServerInterceptor ¶
func ContextUnaryServerInterceptor(modifier IncomingContextModifier) grpc.UnaryServerInterceptor
ContextUnaryServerInterceptor wraps an IncomingContextModifier to create a grpc.UnaryServerInterceptor.
func ForkContext ¶
ForkContext copies all necessary dependencies using the internal ContextInjector registry
func HttpContextMiddleware ¶
func HttpContextMiddleware(modifier IncomingContextModifier) func(http.Handler) http.Handler
func MetaKeysIncomingContext ¶
MetaKeysIncomingContext looks up for keys in grpc metadata IncomingContext and set them in standard metadata map. Keys can be exact matches or prefixes like "something*"
func MetaStreamClientInterceptor ¶
func MetaStreamClientInterceptor(prefix string) grpc.StreamClientInterceptor
func MetaUnaryClientInterceptor ¶
func MetaUnaryClientInterceptor(prefix string) grpc.UnaryClientInterceptor
func MinioMetaFromContext ¶
func MinioMetaFromContext(ctx context.Context, userKey string, forEvents ...bool) (md map[string]string, ok bool)
MinioMetaFromContext prepares metadata for minio client. If forEvents is passed, it replies with the complete set of metadata
func MustWithHint ¶
MustWithHint performs a Get() and panics with a hint message if not found
func RegisterContextInjector ¶
func RegisterContextInjector(injector ContextInjector)
RegisterContextInjector appends a ContextInjector to the internal registry
func RegisterKeyInjector ¶
RegisterKeyInjector creates a context injector that copies the type T from parent to child context
func WithAdditionalMetadata ¶
WithAdditionalMetadata retrieves existing meta, adds new key/values to the map and produces a new context It enforces case-conflicts on all keys
Types ¶
type IncomingContextModifier ¶
IncomingContextModifier modifies context and returns a new context, true if context was modified, or an error
type Metadata ¶
func FromContextCopy ¶
FromContextCopy returns as COPY of the internal metadata, that can be subsequently modified