routesrv

package
v0.21.78 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogPollingStarted       = "starting polling"
	LogPollingStopped       = "polling stopped"
	LogRoutesFetchingFailed = "failed to fetch routes"
	LogRoutesEmpty          = "received empty routes; ignoring"
	LogRoutesInitialized    = "routes initialized"
	LogRoutesUpdated        = "routes updated"
)

Variables

This section is empty.

Functions

func Run

func Run(opts skipper.Options) error

Run starts a route server set up according to the passed options. It is a blocking call designed to be used as a single call/entry point, when running the route server as a standalone binary. It returns, when the server is closed, which can happen due to server startup errors or gracefully handled SIGTERM signal. In case of a server startup error, the error is returned as is.

Types

type RedisEndpoint added in v0.16.5

type RedisEndpoint struct {
	Address string `json:"address"`
}

type RedisEndpoints added in v0.16.5

type RedisEndpoints struct {
	Endpoints []RedisEndpoint `json:"endpoints"`
}

type RedisHandler added in v0.15.30

type RedisHandler struct {
	AddrUpdater func() ([]byte, error)
}

func (*RedisHandler) ServeHTTP added in v0.15.30

func (rh *RedisHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RouteServer

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

RouteServer is used to serve eskip-formatted routes, that originate from the polled data source.

func New

func New(opts skipper.Options) (*RouteServer, error)

New returns an initialized route server according to the passed options. This call does not start data source updates automatically. Kept routes will stay in an uninitialized state, till StartUpdates is called and in effect data source is queried and routes initialized/updated.

func (*RouteServer) ServeHTTP

func (rs *RouteServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves kept eskip-formatted routes under /routes endpoint. Additionally it provides a simple health check under /health and Prometheus-compatible metrics under /metrics.

func (*RouteServer) StartUpdates

func (rs *RouteServer) StartUpdates()

StartUpdates starts the data source polling process.

func (*RouteServer) StopUpdates

func (rs *RouteServer) StopUpdates()

StopUpdates stop the data source polling process.

Jump to

Keyboard shortcuts

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