meta

package
v0.0.0-...-211e212 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckContext

func CheckContext(ctx context.Context) error

CheckContext returns an error if the given context does not contain at least a component and UUID.

func ClientContextInterceptor

func ClientContextInterceptor() grpc.UnaryClientInterceptor

func Component

func Component(ctx context.Context) types.Component

func ExportToOutgoing

func ExportToOutgoing(outgoing context.Context) context.Context

func ImportFromIncoming

func ImportFromIncoming(ctx context.Context, opts ImportOptions) (context.Context, error)

func Log

func Log(ctx context.Context) *zap.SugaredLogger

func NewContext

func NewContext(providers ...providerInitInfo) context.Context

NewContext creates a new context containing data from the given metadata providers.

func NewContextWithParent

func NewContextWithParent(
	parentCtx context.Context,
	providers ...providerInitInfo,
) context.Context

NewContextWithParent creates a new context parented to the given context, and containing data from metadata providers.

func ServerContextInterceptor

func ServerContextInterceptor(
	options ImportOptions,
) grpc.UnaryServerInterceptor

func StreamClientContextInterceptor

func StreamClientContextInterceptor() grpc.StreamClientInterceptor

func StreamServerContextInterceptor

func StreamServerContextInterceptor(
	options ImportOptions,
) grpc.StreamServerInterceptor

func SystemInfo

func SystemInfo(ctx context.Context) *types.SystemInfo

func Tracer

func Tracer(ctx context.Context) opentracing.Tracer

func UUID

func UUID(ctx context.Context) string

func WithProvider

func WithProvider(kp Provider, opts ...withProviderOption) providerInitInfo

func WithValue

func WithValue(value interface{}) withProviderOption

Types

type ImportOptions

type ImportOptions struct {
	Required []Provider
	Optional []Provider
	Inherit  *InheritOptions
}

type InheritOptions

type InheritOptions struct {
	InheritFrom context.Context
	Providers   []Provider
}

type InitProvider

type InitProvider interface {
	Provider
	InitialValue(context.Context) interface{}
}

type MetadataKey

type MetadataKey interface {
	fmt.Stringer
}

type Provider

type Provider interface {
	Key() MetadataKey
	Marshal(interface{}) string
	Unmarshal(string) (interface{}, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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