plugins

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

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

Variables

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

Functions

func NewPluginManager

func NewPluginManager(lc fx.Lifecycle,
	adaptors *adaptors.Adaptors,
	bus bus.Bus,
	entityManager entity_manager.EntityManager,
	mqttServ mqtt.MqttServ,
	scriptService scripts.ScriptService,
	appConfig *m.AppConfig,
	gateClient *gate_client.GateClient,
	eventBus bus.Bus,
	scheduler *scheduler.Scheduler,
	crawler web.Crawler) common.PluginManager

NewPluginManager ...

func RegisterPlugin

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

RegisterPlugin ...

Types

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      bus.Bus
	IsStarted     *atomic.Bool
	Scheduler     *scheduler.Scheduler
	Crawler       web.Crawler
}

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() bus.Bus
	Adaptors() *adaptors.Adaptors
	EntityManager() entity_manager.EntityManager
	ScriptService() scripts.ScriptService
	MqttServ() mqtt.MqttServ
	AppConfig() *m.AppConfig
	GateClient() *gate_client.GateClient
	Scheduler() *scheduler.Scheduler
	Crawler() web.Crawler
}

Service ...

Jump to

Keyboard shortcuts

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