Documentation ¶
Overview ¶
Package frontend implements the frontend server of the load balancer
Index ¶
- Variables
- func AllowRetry(r *http.Request) bool
- func ErrorHandler(u *url.URL, backendServer backend.Server, lb LoadBalancer, logger *slog.Logger) func(http.ResponseWriter, *http.Request, error)
- func Monitor(ctx context.Context, manager serverpool.Manager, logger *slog.Logger)
- type Config
- type LoadBalancer
- type ReqParams
- type ReqParamsContextKey
- type RetryContextKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MinTime is the default timestamp used for the begin of optional time ranges. // Exposed to let downstream projects to reference it. MinTime = time.Unix(math.MinInt64/1000+62135596801, 0).UTC() // MaxTime is the default timestamp used for the end of optional time ranges. // Exposed to let downstream projects to reference it. MaxTime = time.Unix(math.MaxInt64/1000-62135596801, 999999999).UTC() )
These functions are nicked from https://github.com/prometheus/prometheus/blob/main/web/api/v1/api.go
View Source
var (
ErrUnknownClusterID = errors.New("unknown cluster ID")
)
Custom errors.
Functions ¶
func AllowRetry ¶
AllowRetry checks if a failed request can be retried.
func ErrorHandler ¶ added in v0.5.1
func ErrorHandler(u *url.URL, backendServer backend.Server, lb LoadBalancer, logger *slog.Logger) func(http.ResponseWriter, *http.Request, error)
ErrorHandler returns a custom error handler for reverse proxy.
Types ¶
type Config ¶
type Config struct { Logger *slog.Logger LBType base.LBType Address string WebSystemdSocket bool WebConfigFile string APIServer ceems_api_cli.CEEMSAPIServerConfig Manager serverpool.Manager }
Config makes a server config from CLI args.
type LoadBalancer ¶
type LoadBalancer interface { Serve(w http.ResponseWriter, r *http.Request) Start() error Shutdown(ctx context.Context) error ValidateClusterIDs(ctx context.Context) error }
LoadBalancer is the interface to implement.
func New ¶ added in v0.2.0
func New(c *Config) (LoadBalancer, error)
New returns a new instance of load balancer.
type ReqParams ¶ added in v0.5.1
type ReqParams struct {
// contains filtered or unexported fields
}
ReqParams is the context value.
type ReqParamsContextKey ¶ added in v0.5.1
type ReqParamsContextKey struct{}
ReqParamsContextKey is the key used to set context value for request parameters.
type RetryContextKey ¶
type RetryContextKey struct{}
RetryContextKey is the key used to set context value for retry.
Click to show internal directories.
Click to hide internal directories.