servicecontext

package
v4.4.3-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: AGPL-3.0 Imports: 19 Imported by: 4

Documentation

Overview

Package servicecontext performs context values read/write, generally through server or client wrappers

Index

Constants

View Source
const (
	ContextMetaJobUuid        = "X-Pydio-Job-Uuid"
	ContextMetaTaskUuid       = "X-Pydio-Task-Uuid"
	ContextMetaTaskActionPath = "X-Pydio-Task-Action-Path"
	ContextMetaTaskActionTags = "X-Pydio-Task-Action-Tags"
)
View Source
const (
	HttpMetaExtracted     = "HttpMetaExtracted"
	HttpMetaRemoteAddress = "RemoteAddress"
	HttpMetaRequestMethod = "RequestMethod"
	HttpMetaRequestURI    = "RequestURI"
	HttpMetaHost          = "RequestHost"
	HttpMetaHostname      = "RequestHostname"
	HttpMetaPort          = "RequestPort"
	HttpMetaProtocol      = "HttpProtocol"
	HttpMetaUserAgent     = "UserAgent"
	HttpMetaContentType   = "ContentType"
	HttpMetaCookiesString = "CookiesString"
	ClientTime            = "ClientTime"
	ServerTime            = "ServerTime"
	CtxWorkspaceUuid      = "Ctx-Workspace-Uuid"
)
View Source
const (
	SpanMetadataId           = "X-Pydio-Span-Id"
	SpanMetadataRootParentId = "X-Pydio-Span-Root-Id"
	OperationMetadataId      = "X-Pydio-Operation-Id"
)

Variables

This section is empty.

Functions

func ContextStreamServerInterceptor

func ContextStreamServerInterceptor(modifier IncomingContextModifier) grpc.StreamServerInterceptor

ContextStreamServerInterceptor wraps an IncomingContextModifier to create a grpc.StreamServerInterceptor.

func ContextUnaryServerInterceptor

func ContextUnaryServerInterceptor(modifier IncomingContextModifier) grpc.UnaryServerInterceptor

ContextUnaryServerInterceptor wraps an IncomingContextModifier to create a grpc.UnaryServerInterceptor.

func GetBroker added in v4.0.1

func GetBroker(ctx context.Context) broker.Broker

GetBroker returns the broker from the context in argument

func GetDAO

func GetDAO(ctx context.Context) dao.DAO

GetDAO returns the dao from the context in argument

func GetIndexer

func GetIndexer(ctx context.Context) dao.DAO

GetIndexer returns the dao for indexing from the context in argument

func GetKeyring

func GetKeyring(ctx context.Context) crypto.Keyring

GetKeyring returns the keyring from the context in argument

func GetLogger

func GetLogger(ctx context.Context) interface{}

GetLogger tries to find a logger in context

func GetOperationID

func GetOperationID(ctx context.Context) (string, string)

GetOperationID returns the session id associated to this context

func GetRegistry

func GetRegistry(ctx context.Context) registry.Registry

GetRegistry returns the registry from the context in argument

func GetServiceName

func GetServiceName(ctx context.Context) string

GetServiceName returns the service name associated to this context

func HttpMetaFromGrpcContext

func HttpMetaFromGrpcContext(ctx context.Context, name string) (string, bool)

HttpMetaFromGrpcContext extracts metadata from context that may have been passed along across services (meta name may be lowered cased)

func HttpRequestInfoToMetadata

func HttpRequestInfoToMetadata(ctx context.Context, req *http.Request) context.Context

HttpRequestInfoToMetadata extracts as much HTTP metadata as possible and stores it in the context as metadata.

func HttpWrapperMeta

func HttpWrapperMeta(ctx context.Context, h http.Handler) http.Handler

HttpWrapperMeta extracts data from the request and puts it in a context Metadata field.

func HttpWrapperMetrics

func HttpWrapperMetrics(ctx context.Context, h http.Handler) http.Handler

func HttpWrapperSpan

func HttpWrapperSpan(ctx context.Context, h http.Handler) http.Handler

HttpWrapperSpan extracts data from request and put it in context Metadata field

func MetaIncomingContext

func MetaIncomingContext(ctx context.Context) (context.Context, bool, error)

MetaIncomingContext looks for x-cells- metadata keys in IncomingContext and set them in standard metadata map

func MetricsStreamServerInterceptor

func MetricsStreamServerInterceptor() grpc.StreamServerInterceptor

func MetricsUnaryServerInterceptor

func MetricsUnaryServerInterceptor() grpc.UnaryServerInterceptor

func SpanIncomingContext

func SpanIncomingContext(ctx context.Context) (context.Context, bool, error)

SpanIncomingContext updates Spans Ids in context

func SpanStreamClientInterceptor

func SpanStreamClientInterceptor() grpc.StreamClientInterceptor

SpanStreamClientInterceptor inserts specific meta in context (will be later to OutgoingContext meta)

func SpanUnaryClientInterceptor

func SpanUnaryClientInterceptor() grpc.UnaryClientInterceptor

SpanUnaryClientInterceptor inserts specific meta in context (will be later to OutgoingContext meta)

func WithBroker added in v4.0.1

func WithBroker(ctx context.Context, bkr broker.Broker) context.Context

WithBroker links a broker to the context

func WithDAO

func WithDAO(ctx context.Context, dao dao.DAO) context.Context

WithDAO links a dao to the context

func WithIndexer

func WithIndexer(ctx context.Context, dao dao.DAO) context.Context

WithIndexer links a dao for indexation to the context

func WithKeyring

func WithKeyring(ctx context.Context, keyring crypto.Keyring) context.Context

WithKeyring passes a keyring in context

func WithLogger

func WithLogger(ctx context.Context, logger interface{}) context.Context

WithLogger links a logger to the context

func WithOperationID

func WithOperationID(ctx context.Context, operationID string, operationLabel ...string) context.Context

WithOperationID returns a context which knows its session ID

func WithRegistry

func WithRegistry(ctx context.Context, reg registry.Registry) context.Context

WithRegistry links a registry to the context

func WithServiceName

func WithServiceName(ctx context.Context, serviceName string) context.Context

WithServiceName returns a context which knows its service name

func WithSpan

func WithSpan(ctx context.Context, s *Span) context.Context

Types

type IncomingContextModifier

type IncomingContextModifier func(ctx context.Context) (context.Context, bool, error)

IncomingContextModifier modifies context and returns a new context, true if context was modified, or an error

type ServiceRetriever

type ServiceRetriever interface {
	ServiceName() string
}

type Span

type Span struct {
	SpanId       string
	ParentId     string
	RootParentId string
}

func NewSpan

func NewSpan() *Span

func NewSpanFromParent

func NewSpanFromParent(s *Span) *Span

func SpanFromContext

func SpanFromContext(ctx context.Context) (*Span, bool)

func SpanFromHeader

func SpanFromHeader(md map[string]string) (*Span, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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