background

package
v0.2103.8 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Overview

Package background implements utilities for managing background services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceManager

type ServiceManager struct {
	Ctx context.Context
	// contains filtered or unexported fields
}

ServiceManager manages a group of background services.

func NewServiceManager

func NewServiceManager(logger *logging.Logger) *ServiceManager

NewServiceManager creates a new ServiceManager with the provided logger.

func (*ServiceManager) Cleanup

func (m *ServiceManager) Cleanup()

Cleanup cleans up after all registered services.

func (*ServiceManager) Register

func (m *ServiceManager) Register(srv service.BackgroundService)

Register registers a background service.

func (*ServiceManager) RegisterCleanupOnly

func (m *ServiceManager) RegisterCleanupOnly(svc service.CleanupAble, name string)

RegisterCleanupOnly registers a cleanup only background service.

func (*ServiceManager) Stop

func (m *ServiceManager) Stop()

Stop stops all services.

func (*ServiceManager) Wait

func (m *ServiceManager) Wait()

Wait waits for interruption via Stop, SIGINT, SIGTERM, or any of the registered services to terminate, and stops all services.

Jump to

Keyboard shortcuts

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