Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAvailability(ctx context.Context, cc *grpc.ClientConn, id string) error
- func ClientConfig(md meta.PluginMeta, scheme meta.Scheme, opts ...ClientOption) *plugin.ClientConfig
- func ConfigureSysProcAttr(cmd *exec.Cmd)
- func Serve(scheme meta.Scheme)
- func ServeConfig(scheme meta.Scheme) *plugin.ServeConfig
- type ClientOption
- type ClientOptions
- type DiscoveryConfig
- type Filter
- type LoadOption
- type LoadOptions
- type LoaderInterface
- type Main
- type PluginLoader
- type PluginLoaderOption
- type PluginLoaderOptions
Constants ¶
const DefaultPluginGlob = "plugin_*"
Variables ¶
var ( GatewayScheme = meta.NewScheme(meta.WithMode(meta.ModeGateway)) AgentScheme = meta.NewScheme(meta.WithMode(meta.ModeAgent)) )
var ErrNotImplemented = errors.New("not implemented")
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: plugin.CoreProtocolVersion,
MagicCookieKey: "OPNI_MAGIC_COOKIE",
MagicCookieValue: "opni",
}
var NoopLoader = noopLoader{}
Functions ¶
func CheckAvailability ¶
func ClientConfig ¶
func ClientConfig(md meta.PluginMeta, scheme meta.Scheme, opts ...ClientOption) *plugin.ClientConfig
func ConfigureSysProcAttr ¶
func 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 *slog.Logger }
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.UpdateManifest) 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 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, pluginDir string, 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 *slog.Logger) 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. |