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 ¶
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) 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.
Click to show internal directories.
Click to hide internal directories.