behavior

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	AuthHandlers() (func(ctx context.Context, handlers map[string]interface{}) error, error)
}

Authenticator is a behavior that an HTTP authentication feature (plugin) must implement to be used inside the HTTP service implementation.

type Handler

type Handler interface {
	// Cors is a method that must return the CORS options for an HTTP server.
	Cors() cors.Options
}

Handler is a behavior that an HTTP cors plugin must implement if one wants CORS implemented in the HTTP server.

type LoggerExtractor

type LoggerExtractor interface {
	Extract(ctx context.Context) []logger.Attribute
}

LoggerExtractor is an interface that a plugin can implement to provide an API allowing the service extract content from its context to add them into log messages.

type Recovery

type Recovery interface {
	Recover(ctx context.Context)
}

Recovery is a behavior that an HTTP panic recovery feature (plugin) must implement to be used inside the HTTP service implementation.

type Tracer

type Tracer interface {
	// StartMeasurements must retrieve required information from the current
	// application context and initialize any internal information that will
	// be used as metrics for it.
	StartMeasurements(ctx context.Context, serviceType string) (interface{}, error)

	// ComputeMetrics receives an updated context and data returned by the
	// StartMeasurements method to compute the current application metrics.
	ComputeMetrics(ctx context.Context, serviceType string, data interface{}) error
}

Tracer is an interface that a tracing feature plugin should implement to be used by all internal supported services.

type Tracker

type Tracker interface {
	// Generate is responsible for creating a new unique tracker ID.
	Generate() string

	// Add adds a tracker ID into the context and return a new one, updated.
	Add(ctx context.Context, id string) context.Context

	// Retrieve tries to retrieve the tracker ID from the current context and
	// return it.
	Retrieve(ctx context.Context) (string, bool)
}

Tracker is an interface that a plugin should implement to provide a way to add a unique tracing value in each call between services.

Jump to

Keyboard shortcuts

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