helper

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package helper provides utility functions for graceful shutdown management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ShutdownListener added in v0.1.22

type ShutdownListener struct {
	Shutdowners []Shutdowner
}

ShutdownListener manages multiple shutdowner instances and coordinates their shutdown.

func NewShutdownListener added in v0.1.22

func NewShutdownListener() *ShutdownListener

NewShutdownListener creates a new ShutdownListener instance.

func (*ShutdownListener) Register added in v0.1.22

func (s *ShutdownListener) Register(shutdowner Shutdowner)

Register adds a shutdowner to the list of components to be shut down.

func (*ShutdownListener) RegisterFunc added in v0.1.22

func (s *ShutdownListener) RegisterFunc(shutdownFunc func(ctx context.Context) error)

RegisterFunc adds a shutdown function to the list of components to be shut down.

func (*ShutdownListener) Shutdown added in v0.1.22

func (s *ShutdownListener) Shutdown(ctx context.Context) error

Shutdown calls shutdown on all registered shutdowners and returns any errors that occurred.

type Shutdowner added in v0.1.22

type Shutdowner interface {
	Shutdown(ctx context.Context) error
}

Shutdowner is an interface for components that need to be shut down gracefully.

Jump to

Keyboard shortcuts

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