plugins

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

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) common.PluginManager

func RegisterPlugin

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

Types

type Installable

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

type Plugable

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

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
}

func NewPlugin

func NewPlugin() *Plugin

func (*Plugin) Depends

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

func (*Plugin) GetPlugin

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

GetPlugin ...

func (*Plugin) Load

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

func (*Plugin) LoadSettings

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

LoadSettings ...

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Options

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

func (*Plugin) Type

func (p *Plugin) Type() PluginType

func (*Plugin) Unload

func (p *Plugin) Unload() error

func (*Plugin) Version

func (p *Plugin) Version() string

type PluginType

type PluginType string

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
}

Jump to

Keyboard shortcuts

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