modules

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoadLevelLast   = -1
	LoadLevelNormal = 0
	LoadLevelLater  = 1
)

Load Levels

Variables

This section is empty.

Functions

func LoadEnabledModulesConfig

func LoadEnabledModulesConfig(data []byte)

LoadEnabledModulesConfig loads the list of enabled modules from the given config data

Types

type Module

type Module struct {
	Status    enableable
	Name      string
	ConfigKey string

	LoadAfterModules     []string
	LoadBeforeModules    []string
	LoadLevel            int
	Init                 func()
	RegisterHTTPHandlers func(r *mux.Router)
	Reload               func()
	// contains filtered or unexported fields
}

Module is a struct holding information about the different parts of orpheus. Orpheus is split into modules that can be activated separately.

func NewModule

func NewModule(name string, configKey string) *Module

NewModule creates a new module

func (Module) CheckEnabled

func (m Module) CheckEnabled() error

CheckEnabled checks if the module is enabled and returns a ModuleNotLoadedError if not

func (*Module) DependsOn

func (m *Module) DependsOn(s ...string)

DependsOn specifies modules on which this module depends

func (*Module) LoadAfter

func (m *Module) LoadAfter(s ...string)

LoadAfter specifies modules that must be loaded before this module is loaded

func (*Module) LoadBefore

func (m *Module) LoadBefore(s ...string)

LoadBefore specifies modules that must be loaded after this module is loaded

func (Module) NotLoadedError

func (m Module) NotLoadedError() ModuleNotLoadedError

NotLoadedError creates a ModuleNotLoadedError for this Module

func (*Module) Provides

func (m *Module) Provides(s ...string)

Provides specifies modules which this module provides

func (*Module) SetLoadLevel

func (m *Module) SetLoadLevel(level int)

SetLoadLevel sets the load level for this module. A higher load level means that it is loaded later.

func (*Module) TryEnable

func (m *Module) TryEnable(init bool) (enabled bool, retry bool)

TryEnable tries to enable this module

type ModuleNotLoadedError

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

ModuleNotLoadedError is an error type for when a module is not loaded, but used

func NewModuleNotLoadedError

func NewModuleNotLoadedError(moduleName string) ModuleNotLoadedError

NewModuleNotLoadedError creates a new ModuleNotLoadedError

func (ModuleNotLoadedError) Error

func (err ModuleNotLoadedError) Error() string

Jump to

Keyboard shortcuts

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