Version: v0.5.5 Latest Latest

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

Go to latest
Published: Feb 7, 2022 License: GPL-3.0 Imports: 15 Imported by: 0




View Source
const (
	// PluginBuiltIn ...
	PluginBuiltIn = PluginType("System")
	// PluginInstallable ...
	PluginInstallable = PluginType("Installable")


View Source
var (
	// ErrPluginIsLoaded ...
	ErrPluginIsLoaded = errors.New("plugin is loaded")
	// ErrPluginIsUnloaded ...
	ErrPluginIsUnloaded = errors.New("plugin is unloaded")
	// ErrPluginNotLoaded ...
	ErrPluginNotLoaded = errors.New("plugin not loaded")


func NewPluginManager

func NewPluginManager(lc fx.Lifecycle,
	adaptors *adaptors.Adaptors,
	bus event_bus.EventBus,
	entityManager entity_manager.EntityManager,
	mqttServ mqtt.MqttServ,
	scriptService scripts.ScriptService,
	appConfig *m.AppConfig,
	gateClient *gate_client.GateClient,
	eventBus event_bus.EventBus) common.PluginManager

NewPluginManager ...

func RegisterPlugin

func RegisterPlugin(name string, new func() Plugable)

RegisterPlugin ...


type Installable

type Installable interface {
	Install() error
	Uninstall() error

Installable ...

type Plugable

type Plugable interface {
	Load(Service) error
	Unload() error
	Name() string
	Type() PluginType
	Depends() []string
	Version() string
	Options() m.PluginOptions

Plugable ...

type Plugin

type Plugin struct {
	EntityManager entity_manager.EntityManager
	Adaptors      *adaptors.Adaptors
	ScriptService scripts.ScriptService
	PluginManager common.PluginManager
	EventBus      event_bus.EventBus
	IsStarted     *atomic.Bool

Plugin ...

func NewPlugin

func NewPlugin() *Plugin

NewPlugin ...

func (*Plugin) Depends

func (p *Plugin) Depends() []string

Depends ...

func (*Plugin) GetPlugin

func (p *Plugin) GetPlugin(name string) (interface{}, error)

GetPlugin ...

func (*Plugin) Load

func (p *Plugin) Load(service Service) error

Load ...

func (*Plugin) LoadSettings

func (p *Plugin) LoadSettings(pl Plugable) (settings m.Attributes, err error)

LoadSettings ...

func (*Plugin) Name

func (p *Plugin) Name() string

Name ...

func (*Plugin) Options

func (p *Plugin) Options() m.PluginOptions

Options ...

func (*Plugin) Type

func (p *Plugin) Type() PluginType

Type ...

func (*Plugin) Unload

func (p *Plugin) Unload() error

Unload ...

func (*Plugin) Version

func (p *Plugin) Version() string

Version ...

type PluginType

type PluginType string

PluginType ...

type Service

type Service interface {
	Plugins() map[string]Plugable
	PluginManager() common.PluginManager
	EventBus() event_bus.EventBus
	Adaptors() *adaptors.Adaptors
	EntityManager() entity_manager.EntityManager
	ScriptService() scripts.ScriptService
	MqttServ() mqtt.MqttServ
	AppConfig() *m.AppConfig
	GateClient() *gate_client.GateClient

Service ...

Jump to

Keyboard shortcuts

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