types

package
v0.0.1-alpha.22 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOpts

type BuildOpts struct {
	// ExcludeBackend tells the builder to not build the plugin binary. This is useful
	// when we only have changes to UI components.
	ExcludeBackend bool

	// ExcludeUI tells the builder to not rebuild the plugin UI. This is useful
	// when we only have changes to the plugin binary.
	ExcludeUI bool

	// GoPath defines a predefined path to the Go binary
	GoPath string

	// PnpmPath defines a predefined path to the PNPM binary
	PnpmPath string

	// NodePath defines a predefined path to the Node binary
	NodePath string
}

BuildOpts specifies how a plugin should be built.

type ConnectedController

type ConnectedController interface {
	Controller

	// ListAllConnections returns a list of all connections for all plugins.
	ListAllConnections() (map[string][]types.Connection, error)

	// GetConnection returns a connection for a plugin by ID.
	GetConnection(pluginID, connectionID string) (types.Connection, error)

	// GetConnectionNamespaces returns a list of connection namespaces for a plugin.
	GetConnectionNamespaces(pluginID, connectionID string) ([]string, error)

	// ListPluginConnections returns a list of connections for the plugin.
	ListConnections(pluginID string) ([]types.Connection, error)

	// AddConnection adds a new connection for the plugin.
	AddConnection(pluginID string, connection types.Connection) error

	// UpdateConnection updates an existing connection for a plugin
	UpdateConnection(pluginID string, connection types.Connection) (types.Connection, error)

	// RemoveConnection removes a connection for a plugin
	RemoveConnection(pluginID, connectionID string) error

	// Run starts the controller, using the provided context to know when to stop
	Run(ctx context.Context)
}

ConnectedControllers work with plugins that have connections to backend resources. This is a superset of the Controller interface, with additional requirements for when events relating to connections occur.

type Controller

type Controller interface {
	// OnPluginInit is called after the plugin is loaded in to do any pre-startup initialization.
	OnPluginInit(meta config.PluginMeta)

	// OnPluginStart is called when the plugin is started.
	OnPluginStart(meta config.PluginMeta, client plugin.ClientProtocol) error

	// OnPluginStop is called when the plugin is stopped. Modules should perform any persisting of state here
	OnPluginStop(meta config.PluginMeta) error

	// OnPluginShutdown is called when the plugin is shutdown. This is the last chance to clean up any resources
	// before the IDE is closed.
	OnPluginShutdown(meta config.PluginMeta) error

	// OnPluginDestroy is called when the plugin is being removed from the system. This is the last chance to
	// clean up any resources associated with the plugin before it is uninstalled.
	OnPluginDestroy(meta config.PluginMeta) error

	// ListPlugins returns a list of names of the plugins that are installed.
	ListPlugins() ([]string, error)

	// HasPlugin returns true if the plugin is registered with this controller.
	HasPlugin(pluginID string) bool
}

Controller manages the lifecycle of a plugin type. Controllers can embed many managers to take care of different tasks, but at the base must implement the Controller interface.

type PluginManager

type PluginManager interface {
	// OnPluginInit is called after the plugin is loaded in to do any pre-startup initialization.
	OnPluginInit(context.Context, config.PluginMeta) error

	// OnPluginStart is called when the plugin is started.
	OnPluginStart(context.Context, config.PluginMeta) error

	// OnPluginStop is called when the plugin is stopped. Modules should perform any persisting of state here
	OnPluginStop(context.Context, config.PluginMeta) error

	// OnPluginShutdown is called when the plugin is shutdown. This is the last chance to clean up any resources
	// before the IDE is closed.
	OnPluginShutdown(context.Context, config.PluginMeta) error

	// OnPluginDestroy is called when the plugin is being removed from the system. This is the last chance to
	// clean up any resources associated with the plugin before it is uninstalled.
	OnPluginDestroy(context.Context, config.PluginMeta) error
}

PluginManager must fulfil handling the event that happen during the plugin lifecycle.

type PluginManagerConfig

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

PluginManagerConfig is the configuration for the core plugin system.

func (*PluginManagerConfig) PluginsPath

func (c *PluginManagerConfig) PluginsPath() string

PluginsPath returns the path on the filesystem to where plugins are stored.

type PluginState

type PluginState struct {
	Metadata config.PluginMeta
	ID       string
	DevPath  string
	Enabled  bool
	DevMode  bool
}

PluginState holds data about an installed plugin that's written to the filesystem. This is used to track the state of the plugin between restarts of the plugin, especially for working with plugins that are in development mode.

func NewPluginState

func NewPluginState(p types.Plugin) PluginState

func (*PluginState) ToPlugin

func (ps *PluginState) ToPlugin() types.Plugin

Jump to

Keyboard shortcuts

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