service

package
v0.1.2-dev Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoggerAware

type LoggerAware interface {
	SetLogger(logger *slog.Logger)
}

optional interface implemented by services that want a logger injected by the service manager

type Manager

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

func NewManager

func NewManager(shutdownTimeout time.Duration, logger *slog.Logger) *Manager

func (*Manager) Add

func (m *Manager) Add(s Service)

func (*Manager) RunAll

func (m *Manager) RunAll(ctx context.Context) error

func (*Manager) RunSingleService

func (m *Manager) RunSingleService(ctx context.Context, s Service) error

type Service

type Service interface {
	// unique identifier for the service, used in logging
	Name() string

	// start runs the service blocking until the service stops
	Start(ctx context.Context) error

	// stop gracefully shuts down the service within the given context deadline
	Stop(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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