Documentation
¶
Overview ¶
Package pluginregistry records native plugin declarations before runtime execution is enabled.
Index ¶
- Variables
- type ArgsView
- type Component
- type ComponentKind
- type ComponentOrigin
- type ConfigView
- func (v *ConfigView) Decode(target any) error
- func (v *ConfigView) Get(path string) (any, bool)
- func (v *ConfigView) GetPath(path []string) (any, bool)
- func (v *ConfigView) IsZero() bool
- func (v *ConfigView) Sub(path string) pluginapi.ConfigView
- func (v *ConfigView) SubPath(path []string) pluginapi.ConfigView
- type DebugModule
- type PolicyAttributeRegistrar
- type Registrar
- func (r *Registrar) Capabilities() []pluginapi.Capability
- func (r *Registrar) Commit() error
- func (r *Registrar) Components() []Component
- func (r *Registrar) Config() pluginapi.ConfigView
- func (r *Registrar) DebugModules() []DebugModule
- func (r *Registrar) PolicyAttributes() []policyregistry.AttributeDefinition
- func (r *Registrar) RegisterBackend(backend pluginapi.Backend) error
- func (r *Registrar) RegisterDebugModule(definition pluginapi.DebugModuleDefinition) error
- func (r *Registrar) RegisterEnvironmentSource(source pluginapi.EnvironmentSource) error
- func (r *Registrar) RegisterHook(hook pluginapi.Hook) error
- func (r *Registrar) RegisterInitTask(task pluginapi.InitTask) error
- func (r *Registrar) RegisterObligationTarget(target pluginapi.ObligationTarget) error
- func (r *Registrar) RegisterPolicyAttribute(definition pluginapi.AttributeDefinition) error
- func (r *Registrar) RegisterPostActionTarget(target pluginapi.PostActionTarget) error
- func (r *Registrar) RegisterSubjectSource(source pluginapi.SubjectSource) error
- func (r *Registrar) RequireCapability(capability pluginapi.Capability) error
- type Registry
- func (r *Registry) Backends() []Component
- func (r *Registry) Components() []Component
- func (r *Registry) ComponentsByKind(kind ComponentKind) []Component
- func (r *Registry) DebugModules() []DebugModule
- func (r *Registry) DebugModulesByModule(moduleName string) []DebugModule
- func (r *Registry) EnvironmentSources() []Component
- func (r *Registry) HasDebugSelector(selector string) bool
- func (r *Registry) Hooks() []Component
- func (r *Registry) InitTasks() []Component
- func (r *Registry) Lookup(qualifiedName string) (Component, bool)
- func (r *Registry) NewRegistrar(module config.PluginModule) *Registrar
- func (r *Registry) ObligationTargets() []Component
- func (r *Registry) PolicyAttributes() []policyregistry.AttributeDefinition
- func (r *Registry) PostActionTargets() []Component
- func (r *Registry) SubjectSources() []Component
- type RegistryOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNilComponent is returned when a plugin registers a nil component. ErrNilComponent = errors.New("plugin component is nil") // ErrDuplicateComponent is returned when a fully qualified component name already exists. ErrDuplicateComponent = errors.New("duplicate plugin component") // ErrCapabilityNotAllowed is returned when module config does not allow a required capability. ErrCapabilityNotAllowed = errors.New("plugin capability is not allowed") // ErrInvalidDescriptor is returned when a registered component descriptor is invalid. ErrInvalidDescriptor = errors.New("invalid plugin component descriptor") // ErrInvalidPolicyAttribute is returned when a plugin policy attribute cannot be converted. ErrInvalidPolicyAttribute = errors.New("invalid plugin policy attribute") // ErrDuplicateDebugModule is returned when a plugin debug selector already exists. ErrDuplicateDebugModule = errors.New("duplicate plugin debug module") // ErrInvalidDebugModule is returned when a plugin debug module declaration is invalid. ErrInvalidDebugModule = errors.New("invalid plugin debug module") )
Functions ¶
This section is empty.
Types ¶
type ArgsView ¶
type ArgsView struct {
// contains filtered or unexported fields
}
ArgsView exposes immutable policy effect arguments to native plugins.
func NewArgsView ¶
NewArgsView returns a read-only view over policy effect arguments.
type Component ¶
type Component struct {
Value any
SourceDescriptor pluginapi.SourceDescriptor
HookDescriptor pluginapi.HookDescriptor
QualifiedName string
ModuleName string
LocalName string
Kind ComponentKind
Origin ComponentOrigin
}
Component describes one registered plugin component without enabling execution.
type ComponentKind ¶
type ComponentKind string
ComponentKind identifies one plugin extension point family.
const ( // ComponentKindInitTask identifies an init task component. ComponentKindInitTask ComponentKind = "init_task" // ComponentKindEnvironmentSource identifies an environment source component. ComponentKindEnvironmentSource ComponentKind = "environment_source" // ComponentKindSubjectSource identifies a subject source component. ComponentKindSubjectSource ComponentKind = "subject_source" // ComponentKindBackend identifies a backend component. ComponentKindBackend ComponentKind = "backend" // ComponentKindObligationTarget identifies an obligation target component. ComponentKindObligationTarget ComponentKind = "obligation_target" // ComponentKindPostActionTarget identifies a post-action target component. ComponentKindPostActionTarget ComponentKind = "post_action_target" // ComponentKindHook identifies a hook component. ComponentKindHook ComponentKind = "hook" )
type ComponentOrigin ¶
type ComponentOrigin string
ComponentOrigin identifies which integration surface registered a component.
const ( // ComponentOriginNative identifies components registered by native Go plugins. ComponentOriginNative ComponentOrigin = "go" // ComponentOriginLua identifies components adapted from existing Lua configuration. ComponentOriginLua ComponentOrigin = "lua" )
type ConfigView ¶
type ConfigView struct {
// contains filtered or unexported fields
}
ConfigView exposes one immutable-looking plugin configuration subtree.
func NewConfigView ¶
func NewConfigView(data map[string]any) *ConfigView
NewConfigView returns a read-only view over a defensive copy of data.
func (*ConfigView) Decode ¶
func (v *ConfigView) Decode(target any) error
Decode strictly decodes the current subtree into target.
func (*ConfigView) Get ¶
func (v *ConfigView) Get(path string) (any, bool)
Get resolves a dot-separated configuration path.
func (*ConfigView) GetPath ¶
func (v *ConfigView) GetPath(path []string) (any, bool)
GetPath resolves a segment-based configuration path.
func (*ConfigView) IsZero ¶
func (v *ConfigView) IsZero() bool
IsZero reports whether the view has no keys.
func (*ConfigView) Sub ¶
func (v *ConfigView) Sub(path string) pluginapi.ConfigView
Sub returns a view rooted at a dot-separated configuration path.
func (*ConfigView) SubPath ¶
func (v *ConfigView) SubPath(path []string) pluginapi.ConfigView
SubPath returns a view rooted at a segment-based configuration path.
type DebugModule ¶
type DebugModule struct {
Selector string
ModuleName string
LocalName string
Description string
Origin ComponentOrigin
}
DebugModule describes one registered plugin debug selector.
type PolicyAttributeRegistrar ¶
type PolicyAttributeRegistrar interface {
Register(policyregistry.AttributeDefinition) error
}
PolicyAttributeRegistrar accepts converted policy attributes during registrar commit.
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
Registrar records declarations for one module instance.
func (*Registrar) Capabilities ¶
func (r *Registrar) Capabilities() []pluginapi.Capability
Capabilities returns capabilities required during registration.
func (*Registrar) Components ¶
Components returns components declared through this registrar.
func (*Registrar) Config ¶
func (r *Registrar) Config() pluginapi.ConfigView
Config returns the plugin-owned configuration subtree for the module instance.
func (*Registrar) DebugModules ¶
func (r *Registrar) DebugModules() []DebugModule
DebugModules returns plugin-local debug modules declared through this registrar.
func (*Registrar) PolicyAttributes ¶
func (r *Registrar) PolicyAttributes() []policyregistry.AttributeDefinition
PolicyAttributes returns policy attributes declared through this registrar.
func (*Registrar) RegisterBackend ¶
RegisterBackend records a backend declaration.
func (*Registrar) RegisterDebugModule ¶
func (r *Registrar) RegisterDebugModule(definition pluginapi.DebugModuleDefinition) error
RegisterDebugModule records a plugin-local debug module declaration.
func (*Registrar) RegisterEnvironmentSource ¶
func (r *Registrar) RegisterEnvironmentSource(source pluginapi.EnvironmentSource) error
RegisterEnvironmentSource records an environment source declaration.
func (*Registrar) RegisterHook ¶
RegisterHook records a hook declaration.
func (*Registrar) RegisterInitTask ¶
RegisterInitTask records an init task declaration.
func (*Registrar) RegisterObligationTarget ¶
func (r *Registrar) RegisterObligationTarget(target pluginapi.ObligationTarget) error
RegisterObligationTarget records an obligation target declaration.
func (*Registrar) RegisterPolicyAttribute ¶
func (r *Registrar) RegisterPolicyAttribute(definition pluginapi.AttributeDefinition) error
RegisterPolicyAttribute records a native plugin policy attribute declaration.
func (*Registrar) RegisterPostActionTarget ¶
func (r *Registrar) RegisterPostActionTarget(target pluginapi.PostActionTarget) error
RegisterPostActionTarget records a post-action target declaration.
func (*Registrar) RegisterSubjectSource ¶
func (r *Registrar) RegisterSubjectSource(source pluginapi.SubjectSource) error
RegisterSubjectSource records a subject source declaration.
func (*Registrar) RequireCapability ¶
func (r *Registrar) RequireCapability(capability pluginapi.Capability) error
RequireCapability records one capability required by the module instance.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores fully qualified plugin component declarations.
func NewRegistry ¶
func NewRegistry(options ...RegistryOption) *Registry
NewRegistry returns an empty plugin component registry.
func (*Registry) Components ¶
Components returns registered components in registration order.
func (*Registry) ComponentsByKind ¶
func (r *Registry) ComponentsByKind(kind ComponentKind) []Component
ComponentsByKind returns registered components of one kind in registration order.
func (*Registry) DebugModules ¶
func (r *Registry) DebugModules() []DebugModule
DebugModules returns registered plugin debug selectors in registration order.
func (*Registry) DebugModulesByModule ¶
func (r *Registry) DebugModulesByModule(moduleName string) []DebugModule
DebugModulesByModule returns registered plugin debug selectors for one module.
func (*Registry) EnvironmentSources ¶
EnvironmentSources returns registered environment source components.
func (*Registry) HasDebugSelector ¶
HasDebugSelector reports whether an exact plugin debug selector is registered.
func (*Registry) NewRegistrar ¶
func (r *Registry) NewRegistrar(module config.PluginModule) *Registrar
NewRegistrar creates a registrar scoped to one configured module instance.
func (*Registry) ObligationTargets ¶
ObligationTargets returns registered obligation target components.
func (*Registry) PolicyAttributes ¶
func (r *Registry) PolicyAttributes() []policyregistry.AttributeDefinition
PolicyAttributes returns plugin-registered policy attributes in registration order.
func (*Registry) PostActionTargets ¶
PostActionTargets returns registered post-action target components.
func (*Registry) SubjectSources ¶
SubjectSources returns registered subject source components.
type RegistryOption ¶
type RegistryOption func(*Registry)
RegistryOption customizes a component registry.
func WithPolicyAttributeRegistrar ¶
func WithPolicyAttributeRegistrar(registrar PolicyAttributeRegistrar) RegistryOption
WithPolicyAttributeRegistrar forwards committed plugin policy attributes to the policy registry.