shutdown

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoverPanic

func RecoverPanic(logger logrus.FieldLogger)

Types

type DeferFunc

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

type DeferList

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

func NewDeferList

func NewDeferList() *DeferList

func (*DeferList) Defer

func (list *DeferList) Defer(name string, fn func() error)

func (*DeferList) DeferContext

func (list *DeferList) DeferContext(name string, fn func(context.Context) error)

func (*DeferList) DeferContextWithLock

func (list *DeferList) DeferContextWithLock(name string, fn func(ctx context.Context) error)

func (*DeferList) DeferWithLock

func (list *DeferList) DeferWithLock(name string, fn func() error)

func (*DeferList) LockedRun

func (list *DeferList) LockedRun(ctx context.Context, logger logrus.FieldLogger) (string, error)

func (*DeferList) Run

func (list *DeferList) Run(ctx context.Context, logger logrus.FieldLogger) (string, error)

Run runs the defer list. Should be called from the Close function of components. Returns a nonempty string containing the defer message and the error that occurred upon error. Returns empty string and nil error upon success.

func (*DeferList) RunWithChannel

func (list *DeferList) RunWithChannel(ctx context.Context, logger logrus.FieldLogger, ch chan<- error)

type ShutdownTrigger

type ShutdownTrigger struct {
	Trigger context.CancelFunc
}

func ContextWithTrigger

func ContextWithTrigger(ctx context.Context) (context.Context, *ShutdownTrigger)

func (*ShutdownTrigger) SetupSignalHandler

func (trigger *ShutdownTrigger) SetupSignalHandler()

Jump to

Keyboard shortcuts

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