Documentation ¶
Overview ¶
Package servicecontext performs context values read/write, generally through server or client wrappers
Index ¶
- Constants
- func ContextStreamServerInterceptor(modifier IncomingContextModifier) grpc.StreamServerInterceptor
- func ContextUnaryServerInterceptor(modifier IncomingContextModifier) grpc.UnaryServerInterceptor
- func GetBroker(ctx context.Context) broker.Broker
- func GetDAO(ctx context.Context) dao.DAO
- func GetIndexer(ctx context.Context) dao.DAO
- func GetKeyring(ctx context.Context) crypto.Keyring
- func GetLogger(ctx context.Context) interface{}
- func GetOperationID(ctx context.Context) (string, string)
- func GetRegistry(ctx context.Context) registry.Registry
- func GetServiceName(ctx context.Context) string
- func HttpMetaFromGrpcContext(ctx context.Context, name string) (string, bool)
- func HttpRequestInfoToMetadata(ctx context.Context, req *http.Request) context.Context
- func HttpWrapperMeta(ctx context.Context, h http.Handler) http.Handler
- func HttpWrapperMetrics(ctx context.Context, h http.Handler) http.Handler
- func HttpWrapperSpan(ctx context.Context, h http.Handler) http.Handler
- func MetaIncomingContext(ctx context.Context) (context.Context, bool, error)
- func MetricsStreamServerInterceptor() grpc.StreamServerInterceptor
- func MetricsUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func SpanIncomingContext(ctx context.Context) (context.Context, bool, error)
- func SpanStreamClientInterceptor() grpc.StreamClientInterceptor
- func SpanUnaryClientInterceptor() grpc.UnaryClientInterceptor
- func WithBroker(ctx context.Context, bkr broker.Broker) context.Context
- func WithDAO(ctx context.Context, dao dao.DAO) context.Context
- func WithIndexer(ctx context.Context, dao dao.DAO) context.Context
- func WithKeyring(ctx context.Context, keyring crypto.Keyring) context.Context
- func WithLogger(ctx context.Context, logger interface{}) context.Context
- func WithOperationID(ctx context.Context, operationID string, operationLabel ...string) context.Context
- func WithRegistry(ctx context.Context, reg registry.Registry) context.Context
- func WithServiceName(ctx context.Context, serviceName string) context.Context
- func WithSpan(ctx context.Context, s *Span) context.Context
- type IncomingContextModifier
- type ServiceRetriever
- type Span
Constants ¶
const ( ContextMetaJobUuid = "X-Pydio-Job-Uuid" ContextMetaTaskUuid = "X-Pydio-Task-Uuid" ContextMetaTaskActionPath = "X-Pydio-Task-Action-Path" ContextMetaTaskActionTags = "X-Pydio-Task-Action-Tags" )
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" )
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 GetIndexer ¶
GetIndexer returns the dao for indexing from the context in argument
func GetKeyring ¶
GetKeyring returns the keyring from the context in argument
func GetOperationID ¶
GetOperationID returns the session id associated to this context
func GetRegistry ¶
GetRegistry returns the registry from the context in argument
func GetServiceName ¶
GetServiceName returns the service name associated to this context
func HttpMetaFromGrpcContext ¶
HttpMetaFromGrpcContext extracts metadata from context that may have been passed along across services (meta name may be lowered cased)
func HttpRequestInfoToMetadata ¶
HttpRequestInfoToMetadata extracts as much HTTP metadata as possible and stores it in the context as metadata.
func HttpWrapperMeta ¶
HttpWrapperMeta extracts data from the request and puts it in a context Metadata field.
func HttpWrapperSpan ¶
HttpWrapperSpan extracts data from request and put it in context Metadata field
func MetaIncomingContext ¶
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 ¶
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
WithBroker links a broker to the context
func WithIndexer ¶
WithIndexer links a dao for indexation to the context
func WithKeyring ¶
WithKeyring passes a keyring in context
func WithLogger ¶
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 ¶
WithRegistry links a registry to the context
func WithServiceName ¶
WithServiceName returns a context which knows its service name
Types ¶
type IncomingContextModifier ¶
IncomingContextModifier modifies context and returns a new context, true if context was modified, or an error
type ServiceRetriever ¶
type ServiceRetriever interface {
ServiceName() string
}