service

package
v1.6.12 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: BSD-3-Clause Imports: 5 Imported by: 7 modules, 11 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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