Documentation
¶
Index ¶
- func DetectRequired(cfg *config.WorkflowConfig) []string
- func RegisterModuleTypeMapping(moduleType string, capabilities ...string)
- func RegisterTriggerTypeMapping(triggerType string, capabilities ...string)
- func RegisterWorkflowTypeMapping(workflowType string, capabilities ...string)
- func ResetMappings()
- type Contract
- type MethodSignature
- type ProviderEntry
- type Registry
- func (r *Registry) ContractFor(capabilityName string) (*Contract, bool)
- func (r *Registry) HasProvider(capabilityName string) bool
- func (r *Registry) ListCapabilities() []string
- func (r *Registry) ListProviders(capabilityName string) []ProviderEntry
- func (r *Registry) RegisterContract(c Contract) error
- func (r *Registry) RegisterProvider(capabilityName, pluginName string, priority int, implType reflect.Type) error
- func (r *Registry) Resolve(capabilityName string) (*ProviderEntry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectRequired ¶
func DetectRequired(cfg *config.WorkflowConfig) []string
DetectRequired scans a WorkflowConfig and returns the set of capabilities needed. It inspects module types, trigger types, and workflow types and returns a deduplicated, sorted list of required capabilities.
func RegisterModuleTypeMapping ¶
RegisterModuleTypeMapping records that a module type requires certain capabilities.
func RegisterTriggerTypeMapping ¶
RegisterTriggerTypeMapping records trigger type to capability mapping.
func RegisterWorkflowTypeMapping ¶
RegisterWorkflowTypeMapping records workflow type to capability mapping.
func ResetMappings ¶
func ResetMappings()
ResetMappings clears all registered type-to-capability mappings. Intended for testing.
Types ¶
type Contract ¶
type Contract struct {
// Name is the capability identifier (e.g., "http-server", "message-broker").
Name string
// Description is a human-readable explanation of what this capability provides.
Description string
// InterfaceType is the reflect.Type of the Go interface that providers must implement.
InterfaceType reflect.Type
// RequiredMethods lists the method signatures for documentation and validation.
RequiredMethods []MethodSignature
}
Contract defines a capability category that plugins can provide. A contract specifies the Go interface that providers must implement and documents the required method signatures for validation.
type MethodSignature ¶
type MethodSignature struct {
// Name is the method name.
Name string
// Params lists the parameter type names (excluding the receiver).
Params []string
// Returns lists the return type names.
Returns []string
}
MethodSignature describes a single method on a capability interface.
type ProviderEntry ¶
type ProviderEntry struct {
// PluginName is the name of the plugin providing this capability.
PluginName string
// Priority determines provider selection order; higher values win.
Priority int
// InterfaceImpl is the reflect.Type of the concrete type implementing the capability.
InterfaceImpl reflect.Type
}
ProviderEntry represents a plugin that implements a capability.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages capability contracts and their providers. It is safe for concurrent use.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new empty capability registry.
func (*Registry) ContractFor ¶
ContractFor returns the contract for a capability name. Returns false if the capability is not registered.
func (*Registry) HasProvider ¶
HasProvider returns true if at least one provider is registered for the capability.
func (*Registry) ListCapabilities ¶
ListCapabilities returns a sorted list of all registered capability names.
func (*Registry) ListProviders ¶
func (r *Registry) ListProviders(capabilityName string) []ProviderEntry
ListProviders returns all providers registered for a capability. Returns nil if no providers are registered.
func (*Registry) RegisterContract ¶
RegisterContract adds a capability contract to the registry. Returns an error if a contract with the same name already exists but has a different InterfaceType.