plugins

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

+kubebuilder:validation:Optional

Index

Constants

View Source
const (

	// ServicePluginSymbol is symbol that Service level plugins must expose to be loaded.
	// Example usage:
	//
	// func ServicePlugin() ServicePluginIface.
	//
	ServicePluginSymbol = "ServicePlugin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Constructor

type Constructor struct {
	// Config key
	ConfigKey string
	// Plugin Symbols to look for
	PluginSymbols []string
	// default config
	DefaultConfig PluginsConfig
}

Constructor holds fields for constructing a PluginRegistry.

type FxPluginIface

type FxPluginIface interface {
	Module() fx.Option
}

FxPluginIface is an interface for all plugins that provide fx.Option that can be loaded into services, policies, rules etc.

type ModuleConfig

type ModuleConfig struct {
	PluginSymbols []string
}

ModuleConfig holds configuration for the plugin module.

func (ModuleConfig) Module

func (config ModuleConfig) Module() fx.Option

Module is a fx module that provides new plugin registry.

type PluginRegistry

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

PluginRegistry holds fields used for internal tracking of plugin symbols and disabled symbols or plugins of the service.

func (*PluginRegistry) GetPluginTracker

func (registry *PluginRegistry) GetPluginTracker(symbolName string, pluginName string) (*PluginTracker, bool)

GetPluginTracker returns the tracker for the plugin.

func (*PluginRegistry) GetServicePluginOptions

func (registry *PluginRegistry) GetServicePluginOptions() fx.Option

GetServicePluginOptions returns plugin options for all the service-level plugins via trackers.

type PluginTracker

type PluginTracker struct {
	FileInfo *filesystem.FileInfo
	Plugin   *plugin.Plugin
	Symbol   plugin.Symbol
}

PluginTracker tracks single plugin.

type PluginTrackers

type PluginTrackers map[string]*PluginTracker

PluginTrackers tracks plugin name to plugin.

type PluginsConfig

type PluginsConfig struct {
	// Path to plugins directory. "default" points to `/var/lib/aperture/<service>/plugins`.
	PluginsPath string `json:"plugins_path" default:"default"`
	// Specific plugin types to disable
	DisabledSymbols []string `json:"disabled_symbols,omitempty" validate:"omitempty"`
	// Specific plugins to disable
	DisabledPlugins []string `json:"disabled_plugins,omitempty" validate:"omitempty"`
	// Disables all plugins
	DisablePlugins bool `json:"disable_plugins" default:"false"`
}

PluginsConfig holds configuration for plugins. swagger:model +kubebuilder:object:generate=true

func (*PluginsConfig) DeepCopy added in v0.1.2

func (in *PluginsConfig) DeepCopy() *PluginsConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PluginsConfig.

func (*PluginsConfig) DeepCopyInto added in v0.1.2

func (in *PluginsConfig) DeepCopyInto(out *PluginsConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServicePluginIface

type ServicePluginIface interface {
	FxPluginIface
}

ServicePluginIface is an interface for all service level plugins.

Jump to

Keyboard shortcuts

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