shutdown

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0, BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CoreComponent *app.CoreComponent
)
View Source
var ParamsShutdown = &ParametersShutdown{}

Functions

func AppSelfShutdownCaller

func AppSelfShutdownCaller(handler interface{}, params ...interface{})

AppSelfShutdownCaller is used to signal a app self shutdown caused by an error.

Types

type Events

type Events struct {
	// Fired when a app self shutdown was caused by an error.
	AppSelfShutdown *events.Event
	// Fired when a clean shutdown was requested.
	AppShutdown *events.Event
}

Events holds Shutdown related events.

type ParametersShutdown

type ParametersShutdown struct {
	// the maximum time to wait for background processes to finish during shutdown before terminating the app.
	StopGracePeriod time.Duration `` /* 126-byte string literal not displayed */
}

ParametersShutdown contains the definition of the parameters used by shutdown.

type ShutdownHandler

type ShutdownHandler struct {
	// the logger used to log events.
	*logger.WrappedLogger

	// Events are the events that are triggered by the ShutdownHandler.
	Events *Events
	// contains filtered or unexported fields
}

ShutdownHandler waits until a shutdown signal was received or the app tried to shutdown itself, and shuts down all processes gracefully.

func NewShutdownHandler

func NewShutdownHandler(log *logger.Logger, daemon daemon.Daemon) *ShutdownHandler

NewShutdownHandler creates a new shutdown handler.

func (*ShutdownHandler) Run

func (gs *ShutdownHandler) Run()

Run starts the ShutdownHandler go routine.

func (*ShutdownHandler) SelfShutdown

func (gs *ShutdownHandler) SelfShutdown(msg string, critical bool)

SelfShutdown can be called in order to instruct the app to shutdown cleanly without receiving any interrupt signals.

Jump to

Keyboard shortcuts

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