pluginhostv1

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// GetPluginPath returns the path to
	// one or more plugin root directories.
	GetPluginPath() string
	// GetLaunchWaitTimeoutMS returns the timeout in milliseconds
	// for waiting for a plugin to register with the host.
	GetLaunchWaitTimeoutMS() int
	// GetTotalLaunchWaitTimeoutMS returns the timeout in milliseconds
	// for waiting for all plugins to register with the host.
	GetTotalLaunchWaitTimeoutMS() int
	// GetResourceStabilisationPollingTimeoutMS
	// returns the timeout in milliseconds
	// to wait for a resource to stabilise when calls are made
	// into the resource registry through the plugin service.
	// This will be used when a link plugin makes calls to deploy resources
	// via the ResourceDeployService.
	GetResourceStabilisationPollingTimeoutMS() int
	// GetResourceStabilisationPollingIntervalMS
	// returns the interval in milliseconds
	// to poll for a resource to stabilise when calls are made
	// into the resource registry through the plugin service.
	// This will be used when a link plugin makes calls to deploy resources
	// via the ResourceDeployService.
	GetResourceStabilisationPollingIntervalMS() int
	// GetPluginToPluginCallTimeoutMS returns the timeout in milliseconds
	// for waiting for a plugin to respond to a call initiated by another
	// or the same plugin through the plugin service.
	GetPluginToPluginCallTimeoutMS() int
}

Config provides an interface for a plugin host configuration provider.

type LoadDependencies

type LoadDependencies struct {
	Executor         plugin.PluginExecutor
	InstanceFactory  pluginservicev1.PluginFactory
	PluginHostConfig Config
	StateContainer   state.Container
}

LoadDependencies is a struct that holds the required dependencies to set up the plugin host and load plugins. You can use options to override defaults for other dependencies.

type Service

type Service interface {
	// LoadPlugins loads plugins and returns a map of plugin names to their implementations
	// that can be used with the blueprint framework.
	LoadPlugins(ctx context.Context) (*plugin.PluginMaps, error)
	// Manager returns the underlying manager for the plugin host service.
	Manager() pluginservicev1.Manager
	// Close the plugin host service and cleans up resources
	// used by the plugin host.
	// This will usually close the server backing the plugin host instance.
	Close()
}

Service provides an interface for a v1 plugin host.

func LoadDefaultService

func LoadDefaultService(
	dependencies *LoadDependencies,
	opts ...ServiceOption,
) (Service, error)

LoadDefaultService creates a new instance of the default implementation of a plugin host service that uses the gRPC plugin framework. This will set up the plugin host in preparation for loading plugins.

type ServiceOption

type ServiceOption func(*serviceImpl)

ServiceOption is a function that configures the plugin host service with optional dependencies.

func WithIDGenerator

func WithIDGenerator(idGenerator core.IDGenerator) ServiceOption

WithIDGenerator sets the ID generator to generate the ID for the host. The default is to use a UUID generator.

func WithInitialProviders

func WithInitialProviders(providers map[string]provider.Provider) ServiceOption

WithInitialProviders sets the initial providers to be used by the plugin host service. This is particularly useful for ensuring the provider for core blueprint specification functions is available to plugins via the function registry.

func WithPluginServiceListener

func WithPluginServiceListener(listener net.Listener) ServiceOption

WithPluginServiceListener sets the network listener to be used to run the gRPC plugin service that manages plugins. The default is to use a new listener on the default plugin service port.

func WithServiceFS

func WithServiceFS(fs afero.Fs) ServiceOption

WithServiceFS sets the file system to be used by the plugin host service. The default is to use the current OS file system.

func WithServiceLogger

func WithServiceLogger(logger core.Logger) ServiceOption

WithServiceLogger sets the logger to be used by the plugin host service. The default is to use a no-op logger. This should always be provided in production environments.

Jump to

Keyboard shortcuts

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