local

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package local provides a local function executor that runs Go functions in-process without network calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionMetrics

type ExecutionMetrics struct {
	TotalExecutions int64
	SuccessfulCalls int64
	FailedCalls     int64
	AverageLatency  time.Duration
	LastExecutedAt  time.Time
	P99Latency      time.Duration
	P95Latency      time.Duration
}

ExecutionMetrics tracks execution statistics

type FunctionMetadata

type FunctionMetadata struct {
	Name         string
	Description  string
	InputType    string
	OutputType   string
	Timeout      int // seconds
	Retries      int
	Local        bool
	RegisteredAt time.Time
}

FunctionMetadata stores metadata about a registered function

type LocalFunctionExecutor

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

LocalFunctionExecutor implements FunctionExecutorPort for local function execution with production-grade features: metrics, timeouts, retries, concurrency limiting

func NewLocalFunctionExecutor

func NewLocalFunctionExecutor(maxConcurrent int) *LocalFunctionExecutor

NewLocalFunctionExecutor creates a new production-grade local function executor

func (*LocalFunctionExecutor) DeregisterFunction

func (e *LocalFunctionExecutor) DeregisterFunction(name string) error

DeregisterFunction removes a registered function

func (*LocalFunctionExecutor) Execute

func (e *LocalFunctionExecutor) Execute(ctx context.Context, functionName string, input any) (any, error)

Execute synchronously executes a function with timeout and retry support

func (*LocalFunctionExecutor) ExecuteAsync

func (e *LocalFunctionExecutor) ExecuteAsync(ctx context.Context, functionName string, input any) (string, error)

ExecuteAsync asynchronously executes a function

func (*LocalFunctionExecutor) GetMetadata

func (e *LocalFunctionExecutor) GetMetadata(functionName string) (*FunctionMetadata, error)

GetMetadata returns function metadata

func (*LocalFunctionExecutor) GetMetrics

func (e *LocalFunctionExecutor) GetMetrics(functionName string) (*ExecutionMetrics, error)

GetMetrics returns execution metrics for a function

func (*LocalFunctionExecutor) GetResult

func (e *LocalFunctionExecutor) GetResult(ctx context.Context, jobID string) (any, error)

GetResult retrieves an async execution result

func (*LocalFunctionExecutor) IsHealthy

func (e *LocalFunctionExecutor) IsHealthy(ctx context.Context) bool

IsHealthy checks if executor is operational

func (*LocalFunctionExecutor) ListFunctions

func (e *LocalFunctionExecutor) ListFunctions() []string

ListFunctions returns all registered function names

func (*LocalFunctionExecutor) RegisterFunction

func (e *LocalFunctionExecutor) RegisterFunction(name string, fn port.FunctionHandler) error

RegisterFunction registers a new function with metadata

func (*LocalFunctionExecutor) Start

Start initializes the executor

func (*LocalFunctionExecutor) Stop

Stop gracefully shuts down the executor

Jump to

Keyboard shortcuts

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