service

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: BSD-3-Clause Imports: 5 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFactory

func RegisterFactory(factory Factory) error

Types

type Config

type Config struct {
	Settings map[string]interface{} `json:"settings,omitempty"`
}

Config is a simple service configuration object

type Factory

type Factory interface {
	NewService(config *Config) (Service, error)
}

func GetFactory

func GetFactory(ref string) Factory

type Manager

type Manager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Manager is a simple service manager

func NewServiceManager

func NewServiceManager() *Manager

NewServiceManager creates a new Manager

func (*Manager) FindService

func (sm *Manager) FindService(f func(Service) bool) Service

GetService gets specified Service

func (*Manager) GetService

func (sm *Manager) GetService(name string) Service

GetService gets specified Service

func (*Manager) RegisterService

func (sm *Manager) RegisterService(service Service) error

RegisterService registers the specified service

func (*Manager) Services

func (sm *Manager) Services() []Service

Services gets all the registered Service Services

func (*Manager) Start

func (sm *Manager) Start() error

Start implements util.Managed.Start()

func (*Manager) Stop

func (sm *Manager) Stop() error

Stop implements util.Managed.Stop()

type Service

type Service interface {
	managed.Managed
	Name() string
}

Service is an interface for defining/managing a service

Jump to

Keyboard shortcuts

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