service

package
v0.0.0-...-6a25cbf Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const PriorityMax = 5

Variables

This section is empty.

Functions

func Add

func Add(priority int, factory ServiceFactory)

Global service manager apis

func Run

func Run(server string) error

Types

type Service

type Service interface {
	Name() string
	Start() error
	Shutdown()
}

func GetService

func GetService(name string) Service

type ServiceFactory

type ServiceFactory func() (Service, error)

type ServiceManager

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

func NewManager

func NewManager() *ServiceManager

func (*ServiceManager) Add

func (s *ServiceManager) Add(priority int, factory ServiceFactory)

func (*ServiceManager) GetService

func (p *ServiceManager) GetService(name string) Service

GetService return service instance by name, or matched by part of name

func (*ServiceManager) Run

func (s *ServiceManager) Run(server string) error

func (*ServiceManager) Shutdown

func (s *ServiceManager) Shutdown(code int, reason string)

Shutdown

Jump to

Keyboard shortcuts

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