graceful

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Shutdown

func Shutdown(hosted Graceful) error

Shutdown starts an hosted process and responds to SIGINT and SIGTERM to shut the app down. It will return any errors returned by app.Start() that are not caused by shutting down the server.

func ShutdownBySignal

func ShutdownBySignal(hosted Graceful, shouldShutdown chan os.Signal) error

ShutdownBySignal gracefully stops a hosted process based on an os signal channel. A "Graceful" process *must* block on start.

Types

type Graceful

type Graceful interface {
	// Start the service. This must block.
	Start() error
	// Stop the service.
	Stop() error
	// Notify the service has started.
	NotifyStarted() <-chan struct{}
	// Notify the service has stopped.
	NotifyStopped() <-chan struct{}
}

Graceful is a server that can start and shutdown.

Jump to

Keyboard shortcuts

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