Documentation
¶
Overview ¶
Package executor defines the FunctionExecutor interface and provides a concrete implementation that manages function handlers per toolchain type.
Index ¶
- type AttributeRegistration
- type ConcreteFunctionExecutor
- func (e *ConcreteFunctionExecutor) CaptureSignatures(toolchain workerapi.ToolchainType)
- func (e *ConcreteFunctionExecutor) CreateAndRegisterHandler(provider handler.ToolchainProvider) *handler.FunctionHandler
- func (e *ConcreteFunctionExecutor) GetConverter(toolchain workerapi.ToolchainType) (configkit.ConfigConverter, bool)
- func (e *ConcreteFunctionExecutor) GetHandler(toolchain workerapi.ToolchainType) (*handler.FunctionHandler, bool)
- func (e *ConcreteFunctionExecutor) GetResourceProvider(toolchain workerapi.ToolchainType) (yamlkit.ResourceProvider, bool)
- func (e *ConcreteFunctionExecutor) Info() bwapi.FunctionWorkerInfo
- func (e *ConcreteFunctionExecutor) Invoke(ctx context.Context, functionInvocation *funcapi.FunctionInvocationRequest) (*funcapi.FunctionInvocationResponse, error)
- func (e *ConcreteFunctionExecutor) RegisterFunction(toolchain workerapi.ToolchainType, registration handler.FunctionRegistration) error
- func (e *ConcreteFunctionExecutor) RegisterToolchain(provider handler.ToolchainProvider)
- func (e *ConcreteFunctionExecutor) RegisteredFunctions() map[workerapi.ToolchainType]map[string]funcapi.FunctionSignature
- type FunctionExecutor
- type ResourceTypePathsEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributeRegistration ¶
type AttributeRegistration struct {
AttributeName funcapi.AttributeName
ToolchainType workerapi.ToolchainType
Description string
ResourceTypePaths []ResourceTypePathsEntry
Parameters []funcapi.FunctionParameter
}
AttributeRegistration contains the information needed to register a dynamic attribute.
type ConcreteFunctionExecutor ¶
type ConcreteFunctionExecutor struct {
// contains filtered or unexported fields
}
ConcreteFunctionExecutor is the concrete implementation of FunctionExecutor. It manages function handlers per toolchain type and supports registering toolchains and individual functions.
func NewEmptyExecutor ¶
func NewEmptyExecutor() *ConcreteFunctionExecutor
NewEmptyExecutor creates a new ConcreteFunctionExecutor with no functions registered.
func (*ConcreteFunctionExecutor) CaptureSignatures ¶
func (e *ConcreteFunctionExecutor) CaptureSignatures(toolchain workerapi.ToolchainType)
CaptureSignatures updates the signature registry from the handler's current registrations. Call after using CreateAndRegisterHandler to populate the handler via a registrar.
func (*ConcreteFunctionExecutor) CreateAndRegisterHandler ¶
func (e *ConcreteFunctionExecutor) CreateAndRegisterHandler(provider handler.ToolchainProvider) *handler.FunctionHandler
CreateAndRegisterHandler creates a new FunctionHandler for the given provider's toolchain and registers it. Call CaptureSignatures after populating the handler with functions.
func (*ConcreteFunctionExecutor) GetConverter ¶
func (e *ConcreteFunctionExecutor) GetConverter(toolchain workerapi.ToolchainType) (configkit.ConfigConverter, bool)
GetConverter returns the ConfigConverter for the given toolchain type.
func (*ConcreteFunctionExecutor) GetHandler ¶
func (e *ConcreteFunctionExecutor) GetHandler(toolchain workerapi.ToolchainType) (*handler.FunctionHandler, bool)
GetHandler returns the FunctionHandler for the given toolchain type.
func (*ConcreteFunctionExecutor) GetResourceProvider ¶
func (e *ConcreteFunctionExecutor) GetResourceProvider(toolchain workerapi.ToolchainType) (yamlkit.ResourceProvider, bool)
GetResourceProvider returns the ResourceProvider for the given toolchain type.
func (*ConcreteFunctionExecutor) Info ¶
func (e *ConcreteFunctionExecutor) Info() bwapi.FunctionWorkerInfo
Info builds a FunctionWorkerInfo from the registered functions.
func (*ConcreteFunctionExecutor) Invoke ¶
func (e *ConcreteFunctionExecutor) Invoke(ctx context.Context, functionInvocation *funcapi.FunctionInvocationRequest) (*funcapi.FunctionInvocationResponse, error)
Invoke routes a function invocation to the appropriate handler.
func (*ConcreteFunctionExecutor) RegisterFunction ¶
func (e *ConcreteFunctionExecutor) RegisterFunction(toolchain workerapi.ToolchainType, registration handler.FunctionRegistration) error
RegisterFunction registers a single function for a toolchain. If the registration has a FunctionInit, it is called before registration. Returns an error if the toolchain is not initialized or if FunctionInit fails.
func (*ConcreteFunctionExecutor) RegisterToolchain ¶
func (e *ConcreteFunctionExecutor) RegisterToolchain(provider handler.ToolchainProvider)
RegisterToolchain registers a toolchain with its resource provider. The toolchain type is derived from the provider's GetToolchainType method. This creates a new FunctionHandler with the provider, which automatically registers the compute-mutations function.
func (*ConcreteFunctionExecutor) RegisteredFunctions ¶
func (e *ConcreteFunctionExecutor) RegisteredFunctions() map[workerapi.ToolchainType]map[string]funcapi.FunctionSignature
RegisteredFunctions returns the signature registry.
type FunctionExecutor ¶
type FunctionExecutor interface {
RegisteredFunctions() map[workerapi.ToolchainType]map[string]funcapi.FunctionSignature
Invoke(ctx context.Context, functionInvocation *funcapi.FunctionInvocationRequest) (*funcapi.FunctionInvocationResponse, error)
Info() bwapi.FunctionWorkerInfo
}
FunctionExecutor is the interface that function executors must implement to be used with the worker connector. This avoids importing the concrete function package (which pulls in all built-in handler implementations and their dependencies).
type ResourceTypePathsEntry ¶
type ResourceTypePathsEntry struct {
ResourceType funcapi.ResourceType
Paths funcapi.PathToVisitorInfoType
GetterInvocation *funcapi.FunctionInvocation
SetterInvocation *funcapi.FunctionInvocation
}
ResourceTypePathsEntry pairs a resource type with paths and optional getter/setter invocations.