services

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: LGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger added in v0.8.0

type Logger interface {
	Debug(s string)
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger logs formatted strings at the different log levels.

type Service

type Service interface {
	Start() error
	Stop() error
}

Service must be implemented by all services

type ServiceRegistry

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

ServiceRegistry is a structure to manage core system services

func NewServiceRegistry

func NewServiceRegistry(logger Logger) *ServiceRegistry

NewServiceRegistry creates an empty registry

func (*ServiceRegistry) Get

func (s *ServiceRegistry) Get(srvc interface{}) Service

Get retrieves a service and stores a reference to it in the passed in `srvc`

func (*ServiceRegistry) RegisterService

func (s *ServiceRegistry) RegisterService(service Service)

RegisterService stores a new service in the map. If a service of that type has been seen

func (*ServiceRegistry) StartAll

func (s *ServiceRegistry) StartAll()

StartAll calls `Service.Start()` for all registered services

func (*ServiceRegistry) StopAll

func (s *ServiceRegistry) StopAll()

StopAll calls `Service.Stop()` for all registered services

Jump to

Keyboard shortcuts

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