handlers

package
v2.0.1-dev.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpServer

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

HttpServer contains references to dependencies required by the http server implementation.

func NewHttpServer

func NewHttpServer(router *mux.Router, doListenAndServe bool) *HttpServer

NewHttpServer is a factory method that returns an initialized HttpServer receiver struct.

func (*HttpServer) BootstrapHandler

func (b *HttpServer) BootstrapHandler(
	ctx context.Context,
	wg *sync.WaitGroup,
	_ startup.Timer,
	dic *di.Container) bool

BootstrapHandler fulfills the BootstrapHandler contract. It creates two go routines -- one that executes ListenAndServe() and another that waits on closure of a context's done channel before calling Shutdown() to cleanly shut down the http server.

func (*HttpServer) IsRunning

func (b *HttpServer) IsRunning() bool

IsRunning returns whether or not the http server is running. It is provided to support delayed shutdown of any resources required to successfully process http requests until after all outstanding requests have been processed (e.g. a database connection).

type Ready

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

Ready contains references to dependencies required by the testing implementation.

func NewReady

func NewReady(httpServer httpServer, stream chan<- bool) *Ready

NewReady is a factory method that returns an initialized Ready receiver struct.

func (*Ready) BootstrapHandler

func (r *Ready) BootstrapHandler(
	_ context.Context,
	_ *sync.WaitGroup,
	startupTimer startup.Timer,
	_ *di.Container) bool

BootstrapHandler fulfills the BootstrapHandler contract. During normal production execution, a nil stream will be supplied. A non-nil stream indicates we're running within the test runner context and that we should wait for the httpServer to start running before sending confirmation over the stream. If the httpServer doesn't start running within the defined startup time, no confirmation is sent over the stream and the application bootstrapping is aborted.

type StartMessage

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

StartMessage contains references to dependencies required by the start message handler.

func NewStartMessage

func NewStartMessage(serviceKey, version string) *StartMessage

NewStartMessage is a factory method that returns an initialized StartMessage receiver struct.

func (StartMessage) BootstrapHandler

func (h StartMessage) BootstrapHandler(
	_ context.Context,
	_ *sync.WaitGroup,
	startupTimer startup.Timer,
	dic *di.Container) bool

BootstrapHandler fulfills the BootstrapHandler contract. It creates no go routines. It logs a "standard" set of messages when the service first starts up successfully.

Jump to

Keyboard shortcuts

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