plugins

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultPluginGlob = "plugin_*"

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  plugin.CoreProtocolVersion,
	MagicCookieKey:   "OPNI_MAGIC_COOKIE",
	MagicCookieValue: "opni",
}
View Source
var NoopLoader = noopLoader{}

Functions

func CheckAvailability

func CheckAvailability(ctx context.Context, cc *grpc.ClientConn, id string) error

func ClientConfig

func ClientConfig(md meta.PluginMeta, scheme meta.Scheme, opts ...ClientOption) *plugin.ClientConfig

func ConfigureSysProcAttr

func ConfigureSysProcAttr(cmd *exec.Cmd)

func Serve

func Serve(scheme meta.Scheme)

func ServeConfig

func ServeConfig(scheme meta.Scheme) *plugin.ServeConfig

Types

type ClientOption added in v0.8.0

type ClientOption func(*ClientOptions)

func WithReattachConfig added in v0.8.0

func WithReattachConfig(reattach *plugin.ReattachConfig) ClientOption

func WithSecureConfig added in v0.8.0

func WithSecureConfig(sc *plugin.SecureConfig) ClientOption

type ClientOptions added in v0.8.0

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

type DiscoveryConfig added in v0.8.0

type DiscoveryConfig struct {
	// Directory to search for plugins
	Dir string
	// Optional filesystem (defaults to os filesystem)
	Fs afero.Fs
	// Optional filters to allow excluding plugins from discovery
	Filters []Filter
	// If true, query the plugin for its supported modes. The available modes
	// will be stored in the plugin's ExtendedMetadata and can be used in filters.
	QueryModes bool
	// Optional logger, defaults to no logging
	Logger *zap.SugaredLogger
}

func (DiscoveryConfig) Discover added in v0.8.0

func (dc DiscoveryConfig) Discover() []meta.PluginMeta

type Filter added in v0.8.0

type Filter = func(meta.PluginMeta) bool

type LoadOption added in v0.8.0

type LoadOption func(*LoadOptions)

func WithClientOptions added in v0.8.0

func WithClientOptions(clientOptions ...ClientOption) LoadOption

func WithManifest added in v0.8.0

func WithManifest(manifest *controlv1.PluginManifest) LoadOption

WithManifest will use the provided manifest to restrict the set of plugins that can be loaded, and verify plugin checksums before loading. If this option is not provided, plugins will be loaded without any restrictions or verification.

type LoadOptions added in v0.8.0

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

type LoaderInterface added in v0.5.4

type LoaderInterface interface {
	// Adds a hook to the loader, which will be invoked at a specific time according
	// to the hook type. See the specific hooks for more information.
	Hook(h any)
}

type Main added in v0.8.0

type Main struct {
	Modes meta.ModeSet
}

func (*Main) Exec added in v0.8.0

func (m *Main) Exec()

type PluginLoader

type PluginLoader struct {
	PluginLoaderOptions
	// contains filtered or unexported fields
}

func NewPluginLoader

func NewPluginLoader(opts ...PluginLoaderOption) *PluginLoader

func (*PluginLoader) Complete added in v0.5.4

func (p *PluginLoader) Complete()

Complete marks the plugin loader as completed. This function will be called automatically by LoadPlugins(), although it can be called manually if LoadPlugins() is not used. It is not safe to call this function and LoadPlugins() on the same plugin loader. It will invoke LoadingCompletedHooks in parallel and does not block.

func (*PluginLoader) Hook added in v0.5.4

func (p *PluginLoader) Hook(h any)

func (*PluginLoader) LoadOne added in v0.5.4

func (p *PluginLoader) LoadOne(ctx context.Context, md meta.PluginMeta, cc *plugin.ClientConfig)

LoadOne loads a single plugin. It invokes PluginLoadHooks for the type of the plugin being loaded and will block until all load hooks have completed.

func (*PluginLoader) LoadPlugins added in v0.5.4

func (p *PluginLoader) LoadPlugins(ctx context.Context, conf v1beta1.PluginsSpec, scheme meta.Scheme, opts ...LoadOption)

LoadPlugins loads a set of plugins defined by the plugin configuration. This function loads plugins in parallel and does not block. It will invoke LoadingCompletedHooks once all plugins have been loaded. Once this function is called, it is unsafe to call LoadPlugins() or LoadOne() again for this plugin loader, although new hooks can still be added and will be invoked immediately according to the current state of the plugin loader.

type PluginLoaderOption added in v0.8.0

type PluginLoaderOption func(*PluginLoaderOptions)

func WithLogger added in v0.8.0

func WithLogger(lg *zap.SugaredLogger) PluginLoaderOption

type PluginLoaderOptions added in v0.8.0

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

Directories

Path Synopsis
Package apis can be imported to ensure all plugin APIs are added to client schemes.
Package apis can be imported to ensure all plugin APIs are added to client schemes.
Package hooks contains interfaces used to invoke callbacks at specific points during the plugin loading process.
Package hooks contains interfaces used to invoke callbacks at specific points during the plugin loading process.

Jump to

Keyboard shortcuts

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