shutdown

package module
Version: v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

README

GoDoc tag release

Go Report Card Build Status Maintainability Test Coverage

A simple shutdown watcher with a destructor.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Destructor

type Destructor func()

type Shutdown added in v0.2.0

type Shutdown struct {
	Destructor Destructor

	*log.Logger
	// contains filtered or unexported fields
}

Shutdown listens for SIGINT and SIGTERM and executes the Destructor

func New added in v0.2.0

func New(destruct Destructor) *Shutdown

New generates a new Shutdown with typical defaults

func (*Shutdown) Handler added in v0.7.0

func (shutdown *Shutdown) Handler(handler http.Handler) http.Handler

wraps any request and checks to make sure that the server isn't shutting down

func (*Shutdown) IsDown added in v0.3.0

func (shutdown *Shutdown) IsDown() bool

IsDown checks to see if the shutdown has been triggered

func (*Shutdown) Now added in v0.2.0

func (shutdown *Shutdown) Now(reason string)

Now allows an application to trigger it's own shutdown

func (*Shutdown) SetDestructor added in v0.7.0

func (shutdown *Shutdown) SetDestructor(destruct Destructor)

func (*Shutdown) Wait added in v0.5.0

func (shutdown *Shutdown) Wait()

Wait is a func that allows the calling context to block until shutdown is finished

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL