shutdown

package module
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: BSD-3-Clause Imports: 6 Imported by: 1

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 Listener added in v0.7.1

type Listener func(chan os.Signal)

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, signals []syscall.Signal) *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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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