shutdown

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: GPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func() (status string, err error)

Callback is a function to provide service shutdown. This function should return status of shutdown and error in case of problems.

type Handler

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

Handler handles shutting process

func NewHandler

func NewHandler(logger logrus.FieldLogger) *Handler

NewHandler creates an instance of Handler

func (*Handler) AddShutdownSignal

func (h *Handler) AddShutdownSignal(sig os.Signal)

AddShutdownSignal adds a user-defined signals to shutdown. It might be helpful for testing.

func (*Handler) RegisterShutdown

func (h *Handler) RegisterShutdown(shutdown Callback)

RegisterShutdown set up a channel where we can send signal notifications and listen for the signal. We must use a buffered channel, or risk missing the signal if we're not ready to receive it when the signal is sent. We strongly recommend to use this function once. ToDo: how do we want to process case if user register few different shutdowns?

Jump to

Keyboard shortcuts

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