server

package
v0.0.0-...-2a62d63 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentService

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

ContentService is an HTTP handler which looks up the relevant static files and serves them to the client.

func (*ContentService) Cleanup

func (service *ContentService) Cleanup()

Cleanup cancels all config watch operations currently in progress. It should be invoked in response to termination signals being received.

func (*ContentService) IsHealthy

func (service *ContentService) IsHealthy() bool

IsHealthy determines whether the service is configured and ready to handle requests. If IsHealthy is false, any requests should be rejected.

func (*ContentService) MainLoop

func (service *ContentService) MainLoop(listenAddr string) error

MainLoop creates the HTTP listener and starts listening to connections. The function only exits if a listener could not be created, or once the listener has shut down.

func (*ContentService) ServeHTTP

func (service *ContentService) ServeHTTP(
	w http.ResponseWriter, r *http.Request)

ServeHTTP retrieves the requested file from the static config store and returns it to the requestor.

func (*ContentService) ServingConfig

func (service *ContentService) ServingConfig(contents []byte)

ServingConfig receives a new configuration protocol buffer in binary format and attempts to parse and enact it. If there were problems applying the new configuration, the old configuration will be used.

func (*ContentService) WatchForConfigChanges

func (service *ContentService) WatchForConfigChanges(
	client *etcd.Client, etcdTimeout time.Duration, configPath string)

WatchForConfigChanges watches the configured etcd location for updates and invokes ServingConfig as required.

This function should only ever be called once, during initialization, and will continue running in the background. Parallel invocations of this fuction on the same ContentService will block until the previous incarnation has exited.

Jump to

Keyboard shortcuts

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