frontend

package
v0.1.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package frontend implements the frontend server of the load balancer

Index

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

Functions

func AllowRetry

func AllowRetry(r *http.Request) bool

AllowRetry checks if a failed request can be retried

func Monitor

func Monitor(ctx context.Context, manager serverpool.Manager, logger log.Logger)

Monitor checks the backend servers health

Types

type Config

type Config struct {
	Logger           log.Logger
	Address          string
	WebSystemdSocket bool
	WebConfigFile    string
	DBPath           string
	Manager          serverpool.Manager
}

Config makes a server config from CLI args

type LoadBalancer

type LoadBalancer interface {
	Serve(http.ResponseWriter, *http.Request)
	Start() error
	Shutdown(context.Context) error
}

LoadBalancer is the interface to implement

func NewLoadBalancer

func NewLoadBalancer(c *Config) (LoadBalancer, error)

NewLoadBalancer returns a new instance of load balancer

type RetryContextKey

type RetryContextKey struct{}

RetryContextKey is the key used to set context value for retry

Jump to

Keyboard shortcuts

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