signal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 11

Documentation

Overview

Package signal implements a run.GroupService handling incoming unix signals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// RefreshCallback is called when a syscall.SIGHUP is received.
	// If the callback returns an error, the signal handler is stopped. In a
	// run.Group environment this means the entire run.Group is requested to
	// stop.
	RefreshCallback func() error
	// contains filtered or unexported fields
}

Handler implements a unix signal handler as run.GroupService.

func (*Handler) Name

func (h *Handler) Name() string

Name implements run.Unit.

func (*Handler) PreRun

func (h *Handler) PreRun() error

PreRun implements run.PreRunner to initialize the handler.

func (*Handler) ServeContext added in v0.2.1

func (h *Handler) ServeContext(ctx context.Context) error

ServeContext implements run.ServiceContext and listens for incoming unix signals. If a callback handler was registered it will be executed if a "SIGHUP" is received. If the callback handler returns an error it will exit in error and initiate Group shutdown if used in a run.Group environment.

Jump to

Keyboard shortcuts

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