shutdown

package
v0.0.0-...-87fd372 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func()

The Func type is an adapter to allow the use of ordinary functions as ShutdownableService.

func (Func) Shutdown

func (f Func) Shutdown() error

Shutdown calls wrapped f().

type ParentService

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

ParentService aggregates services that are Shutdownable. Those services are registered in parent and shutdown is cascaded to them.

func (*ParentService) Register

func (s *ParentService) Register(child ShutdownableService)

Register is registering dependent service to be shutdown on parent service shutdown.

func (*ParentService) Shutdown

func (s *ParentService) Shutdown() error

Shutdown is called to trigger shutdown of all associated children. It waits for all children.

Child shutdown is considered successful also in cases when context.Cancelled error is returned.

type ShutdownableService

type ShutdownableService interface {
	Shutdown() error
}

ShutdownableService represents a service that supports graceful shutdown pattern.

Jump to

Keyboard shortcuts

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