shutdown

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler represents a handler for shutdown events

func InstallHandler

func InstallHandler(orderedStopables []Stopable, logger zerolog.Logger) *Handler

InstallHandler installs a handler for syscall.SIGINT, syscall.SIGTERM

func (Handler) IsHealthy

func (h Handler) IsHealthy() error

IsHealthy returns an error in case a shutdown is currently in progress. The error is returned to indicate that the service is not healthy any more (can't handle any requests)

func (*Handler) Register added in v0.0.5

func (h *Handler) Register(stopable Stopable, front ...bool)

Register a Stopable for shutdown handling. Per default the Stopable is added to the front of the list of Stopable's this means the Stopable that was the last one registered will be the first being called for shutdown. If you call Register(stopable,false) you can add this Stopable to the end of the list of registered Stopables.

func (Handler) String

func (h Handler) String() string

Name returns the name of this handler

func (*Handler) WaitUntilSignal added in v0.0.4

func (h *Handler) WaitUntilSignal()

WaitUntilSignal waits/ blocks until either syscall.SIGINT or syscall.SIGTERM was issued to the process

type Stopable

type Stopable interface {

	// Stop will be called as soon as the shutdown signal was caught.
	// Hence within this method all teardown actions should be done (e.g. free resources, leave task main loops, ...)
	Stop() error

	// String ... to meet the Stringer interface
	String() string
}

Stopable is a interface for runnable sokar components

Jump to

Keyboard shortcuts

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