plugin

package
v0.0.0-...-3f5d8b5 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginDevInstallEventStart = "plugin/dev_install_start"
	PluginReloadEventStart     = "plugin/dev_reload_start"
	PluginReloadEventError     = "plugin/dev_reload_error"
	PluginReloadEventComplete  = "plugin/dev_reload_complete"
)
View Source
const (
	MaxPluginSize             = 1024 * 1024 * 1024 // 1GB
	PluginInstallStartedEvent = "plugin/install_started"
)
View Source
const (
	DedupInterval = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

func Copy

func Copy(srcFile, dstFile string) error

func CopyDir

func CopyDir(dst, src string) error

CopyDir copies the content of src to dst. src should be a full path.

func CopyDirectory

func CopyDirectory(scrDir, dest string) error
func CopySymLink(source, dest string) error

func CreateIfNotExists

func CreateIfNotExists(dir string, perm os.FileMode) error

func Exists

func Exists(filePath string) bool

Types

type LoadPluginOptions

type LoadPluginOptions struct {
	DevMode       bool
	DevModePath   string
	ExistingState *plugintypes.PluginState
}

type Manager

type Manager interface {
	// Initialize discovers and loads all plugins that are currently installed in the plugin directory,
	// and initializes them with the appropriate controllers.
	Initialize(ctx context.Context) error

	// Run starts until the the passed in context is cancelled
	Run(ctx context.Context)

	// Shutdown stops the plugin manager and all plugins.
	Shutdown()

	// InstallInDevMode installs a plugin from the given path, and sets up a watcher to recompile and reload the plugin
	// when changes are detected. Will prompt the user for a path.
	InstallInDevMode() (*config.PluginMeta, error)

	// InstallFromPathPrompt installs a plugin from the given path, prompting the user for the location
	// with a window dialog.
	InstallFromPathPrompt() (*config.PluginMeta, error)

	// InstallPluginFromPath installs a plugin from the given path. It will validate the plugin
	// and then load it into the manager.
	InstallPluginFromPath(path string) (*config.PluginMeta, error)

	// LoadPlugin loads a plugin at the given path. It will validate the plugin
	// and then load it into the manager.
	LoadPlugin(id string, opts *LoadPluginOptions) (types.Plugin, error)

	// ReloadPlugin reloads a plugin at the given path. It will validate the plugin
	// and then load it into the manager.
	ReloadPlugin(id string) (types.Plugin, error)

	// UninstallPlugin uninstalls a plugin from the manager, and removes it from the filesystem.
	UninstallPlugin(id string) (types.Plugin, error)

	// GetPlugin returns the plugin with the given plugin ID.
	GetPlugin(id string) (types.Plugin, error)

	// ListPlugins returns a list of all plugins that are currently registered with the manager.
	ListPlugins() []types.Plugin

	// GetPluginMeta returns the plugin metadata for the given plugin ID.
	GetPluginMeta(id string) (config.PluginMeta, error)

	// ListPlugins returns a list of all plugins that are currently registered with the manager.
	ListPluginMetas() []config.PluginMeta
}

Manager manages the lifecycle and registration of plugins. It is responsible for registering and unregistering plugins, and communicating with the plugin controllers to handle the lifecycle of the plugins.

func NewManager

func NewManager(
	logger *zap.SugaredLogger,
	resourceController resource.Controller,
	settingsController settings.Controller,
	execController pluginexec.Controller,
	networkerController networker.Controller,
	managers map[string]plugintypes.PluginManager,
) Manager

NewManager returns a new plugin manager for the IDE to use to manager installed plugins.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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