server

package
v0.0.0-...-8018a7e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.0.16"

Variables

This section is empty.

Functions

func CreateHandlerAWS

func CreateHandlerAWS(key string, awsConfig *conf.AWSConfig, enterpriseSystem enterprise.Enterprise, serverWaitGroup *sync.WaitGroup) (handler awshandler.HandlerInterface, router *mux.Router, toListen bool)

Create a handler from config

func CreateHandlerGCP

func CreateHandlerGCP(key string, gcpConfig *conf.AWSConfig, enterpriseSystem enterprise.Enterprise, serverWaitGroup *sync.WaitGroup) (handler awshandler.HandlerInterface, router *mux.Router, toListen bool)

Create a handler from config

func Listen

func Listen(config *conf.Config, serverWaitGroup *sync.WaitGroup, enterpriseSystem enterprise.Enterprise)

Listen for all configured services. Gets called when started or configs change

func Main

func Main(config *conf.Config, onConfigChange <-chan string, cmd *cobra.Command, args []string)

Main function, runs http server

Types

type RouteWrapper

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

Router with a lock

func (*RouteWrapper) ChangeRouter

func (wrapper *RouteWrapper) ChangeRouter(newRouter *RouterWithCounter, oldHandler awshandler.HandlerInterface)

Switch router when config changes

func (*RouteWrapper) ServeHTTP

func (wrapper *RouteWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)

Interface implementation gets called on each request. Makes sure to use a lock in case router changes

type RouterWithCounter

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

Mux router with counter to make sure we don't close anything in use

func (*RouterWithCounter) ServeHTTP

func (router *RouterWithCounter) ServeHTTP(w http.ResponseWriter, r *http.Request)

Interface implementation gets called on each request that keeps track of current request count

func (*RouterWithCounter) ShutdownWhenReady

func (router *RouterWithCounter) ShutdownWhenReady(handler awshandler.HandlerInterface)

Shutdown a handler if there are no current requests

Jump to

Keyboard shortcuts

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