executor

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package executor defines the FunctionExecutor interface and provides a concrete implementation that manages function handlers per toolchain type.

Index

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

GetConverter returns the ConfigConverter for the given toolchain type.

func (*ConcreteFunctionExecutor) GetHandler

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

Info builds a FunctionWorkerInfo from the registered functions.

func (*ConcreteFunctionExecutor) Invoke

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

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.

Jump to

Keyboard shortcuts

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