frontend

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHandler utils.ErrorHandler = &StdHandler{}

DefaultHandler default error handler.

Functions

This section is empty.

Types

type StdHandler added in v0.9.2

type StdHandler struct{}

StdHandler Standard error handler.

func (*StdHandler) ServeHTTP added in v0.9.2

func (e *StdHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, err error)

type T

type T struct {
	// contains filtered or unexported fields
}

T represents a frontend instance. It implements http.Handler interface to be used with an http.Server. The implementation takes measures to collect round trip metrics for the frontend and all servers of an associated backend.

func New

func New(cfg engine.Frontend, be *backend.T, opts proxy.Options,
	mwCfgs map[engine.MiddlewareKey]engine.Middleware,
	listeners plugin.FrontendListeners,
) *T

New returns a new frontend instance.

func (*T) AppendAllBeSrvRTMsTo

func (fe *T) AppendAllBeSrvRTMsTo(aggregates map[backend.SrvURLKey]rtmcollect.BeSrvEntry)

AppendAllBeSrvRTMsTo appends round-trip metrics of all backend servers of the backend associated with the frontend to the respective aggregates. If an aggregate for a server is missing from the map then a new one is created.

func (*T) AppendBeSrvRTMTo

func (fe *T) AppendBeSrvRTMTo(aggregate *memmetrics.RTMetrics, beSrvURLKey backend.SrvURLKey)

AppendBeSrvRTMTo appends round-trip metrics of a backend server to aggregate. It does nothing if a server if the specified URL key does not exist.

func (*T) AppendRTMTo

func (fe *T) AppendRTMTo(aggregate *memmetrics.RTMetrics)

AppendRTMTo appends frontend round-trip metrics to an aggregate.

func (*T) BackendKey

func (fe *T) BackendKey() engine.BackendKey

BackendKey returns the storage key of an associated backend.

func (*T) CfgWithStats

func (fe *T) CfgWithStats() (engine.Frontend, bool, error)

CfgWithStats returns the frontend storage config with associated round trip stats.

func (*T) DeleteMiddleware

func (fe *T) DeleteMiddleware(mwKey engine.MiddlewareKey)

DeleteMiddleware deletes a middleware if there is one with the specified storage key or does nothing otherwise.

func (*T) Key

func (fe *T) Key() engine.FrontendKey

Key returns the frontend storage key.

func (*T) OnBackendMutated

func (fe *T) OnBackendMutated()

OnBackendMutated should be called when state of the associated backend is changed, e.g. when a new backend server is added or something like that.

func (*T) Route

func (fe *T) Route() string

Route returns HTTP path. It should be used to configure an HTTP router to forward requests coming to the path to this frontend instance.

func (*T) ServeHTTP

func (fe *T) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

func (*T) String

func (fe *T) String() string

String returns a string representation of the instance to be used in logs.

func (*T) Update

func (fe *T) Update(feCfg engine.Frontend, be *backend.T) error

Update updates the config and/or association with a backend.

func (*T) UpsertMiddleware

func (fe *T) UpsertMiddleware(mwCfg engine.Middleware)

UpsertMiddleware upserts a middleware.

Jump to

Keyboard shortcuts

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