loader

package
v0.0.0-...-11c0a12 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: GPL-3.0 Imports: 6 Imported by: 91

Documentation

Index

Constants

View Source
const (
	ErrorNoDependencies int = iota
	ErrorCircleDependencies
	ErrorMissingModule
	ErrorInternalError
	ErrorConflict
)

Variables

This section is empty.

Functions

func EnableModules

func EnableModules(enablingModules []string, disableModules []string, flag EnableFlag) error

func GetService

func GetService() *dbusutil.Service

func Register

func Register(m Module)

func SetLogLevel

func SetLogLevel(pri log.Priority)

func SetService

func SetService(s *dbusutil.Service)

func StartAll

func StartAll()

func StopAll

func StopAll()

TODO: check dependencies

func ToggleLogDebug

func ToggleLogDebug(enabled bool)

Types

type DAGBuilder

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

func NewDAGBuilder

func NewDAGBuilder(loader *Loader, enablingModules []string, disableModules []string, flag EnableFlag) *DAGBuilder

func (*DAGBuilder) Execute

func (builder *DAGBuilder) Execute() (*graph.Data, error)

type EnableError

type EnableError struct {
	ModuleName string
	Code       int
	// contains filtered or unexported fields
}

func (*EnableError) Error

func (e *EnableError) Error() string

type EnableFlag

type EnableFlag int
const (
	EnableFlagNone EnableFlag = 1 << iota
	EnableFlagIgnoreMissingModule
	EnableFlagForceStart
)

func (EnableFlag) HasFlag

func (flags EnableFlag) HasFlag(flag EnableFlag) bool

type Loader

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

func (*Loader) AddModule

func (l *Loader) AddModule(m Module)

func (*Loader) DeleteModule

func (l *Loader) DeleteModule(name string)

func (*Loader) EnableModules

func (l *Loader) EnableModules(enablingModules []string, disableModules []string, flag EnableFlag) error

func (*Loader) GetModule

func (l *Loader) GetModule(name string) Module

func (*Loader) List

func (l *Loader) List() []Module

func (*Loader) SetLogLevel

func (l *Loader) SetLogLevel(pri log.Priority)

type Module

type Module interface {
	Name() string
	IsEnable() bool
	Enable(bool) error
	GetDependencies() []string
	SetLogLevel(log.Priority)
	LogLevel() log.Priority
	ModuleImpl
}

func GetModule

func GetModule(name string) Module

func List

func List() []Module

type ModuleBase

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

func NewModuleBase

func NewModuleBase(name string, impl ModuleImpl, logger *log.Logger) *ModuleBase

func (*ModuleBase) Enable

func (d *ModuleBase) Enable(enable bool) error

func (*ModuleBase) IsEnable

func (d *ModuleBase) IsEnable() bool

func (*ModuleBase) LogLevel

func (d *ModuleBase) LogLevel() log.Priority

func (*ModuleBase) Name

func (d *ModuleBase) Name() string

func (*ModuleBase) SetLogLevel

func (d *ModuleBase) SetLogLevel(pri log.Priority)

type ModuleImpl

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

type Modules

type Modules []Module

func (Modules) Delete

func (l Modules) Delete(name string) (Modules, bool)

func (Modules) Get

func (l Modules) Get(name string) Module

func (Modules) Len

func (l Modules) Len() int

func (Modules) Less

func (l Modules) Less(i, j int) bool

func (Modules) List

func (l Modules) List() []string

func (Modules) Swap

func (l Modules) Swap(i, j int)

Jump to

Keyboard shortcuts

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