services

package
v0.0.0-...-c69f244 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service must be implemented by all services

type ServiceRegisterer

type ServiceRegisterer interface {
	RegisterService(service Service)
	StartAll()
	StopAll()
	Get(srvc interface{}) Service
}

ServiceRegisterer can register a service interface, start or stop all services, and get a particular service.

type ServiceRegistry

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

ServiceRegistry is a structure to manage core system services

func NewServiceRegistry

func NewServiceRegistry(logger log.LeveledLogger) *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