Documentation
¶
Index ¶
- type FunctionHandler
- type FunctionInfo
- type FunctionMetrics
- type MetricsCollector
- type Registry
- func (r *Registry) Execute(name string, input map[string]interface{}) (interface{}, error)
- func (r *Registry) GetFunctionMetrics(name string) (FunctionMetrics, bool)
- func (r *Registry) GetMetrics() map[string]FunctionMetrics
- func (r *Registry) ListFunctions() []common.FunctionInfo
- func (r *Registry) Register(name string, handler common.FunctionHandler, info common.FunctionInfo)
- func (r *Registry) RegisterWasmFunction(name string, wasmFile string, exportName string, info common.FunctionInfo) error
- type WasmFunctionHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FunctionHandler ¶
type FunctionHandler = common.FunctionHandler
FunctionHandler is the interface that all serverless functions must implement Deprecated: Use common.FunctionHandler instead
type FunctionInfo ¶
type FunctionInfo = common.FunctionInfo
FunctionInfo represents metadata about a registered function Deprecated: Use common.FunctionInfo instead
type FunctionMetrics ¶
type FunctionMetrics struct { Name string `json:"name"` ExecutionCount int64 `json:"execution_count"` AverageDuration time.Duration `json:"average_duration"` ErrorCount int64 `json:"error_count"` LastExecutionTime time.Time `json:"last_execution_time"` ColdStartCount int64 `json:"cold_start_count"` AvgColdStartLatency time.Duration `json:"avg_cold_start_latency"` }
FunctionMetrics represents metrics for a function
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector collects metrics for function executions
func NewMetricsCollector ¶
func NewMetricsCollector() *MetricsCollector
NewMetricsCollector creates a new metrics collector
func (*MetricsCollector) GetFunctionMetrics ¶
func (m *MetricsCollector) GetFunctionMetrics(functionName string) (FunctionMetrics, bool)
GetFunctionMetrics returns metrics for a specific function
func (*MetricsCollector) GetMetrics ¶
func (m *MetricsCollector) GetMetrics() map[string]FunctionMetrics
GetMetrics returns metrics for all functions
func (*MetricsCollector) RecordExecution ¶
func (m *MetricsCollector) RecordExecution(functionName string, duration time.Duration, err error)
RecordExecution records a function execution
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages the serverless functions
func (*Registry) GetFunctionMetrics ¶
func (r *Registry) GetFunctionMetrics(name string) (FunctionMetrics, bool)
GetFunctionMetrics returns metrics for a specific function
func (*Registry) GetMetrics ¶
func (r *Registry) GetMetrics() map[string]FunctionMetrics
GetMetrics returns metrics for all functions
func (*Registry) ListFunctions ¶
func (r *Registry) ListFunctions() []common.FunctionInfo
ListFunctions returns a list of all registered functions
func (*Registry) Register ¶
func (r *Registry) Register(name string, handler common.FunctionHandler, info common.FunctionInfo)
Register registers a new function
func (*Registry) RegisterWasmFunction ¶
func (r *Registry) RegisterWasmFunction(name string, wasmFile string, exportName string, info common.FunctionInfo) error
RegisterWasmFunction registers a WebAssembly function
type WasmFunctionHandler ¶
type WasmFunctionHandler struct {
// contains filtered or unexported fields
}
WasmFunctionHandler implements FunctionHandler for WebAssembly functions
func (*WasmFunctionHandler) Execute ¶
func (h *WasmFunctionHandler) Execute(input map[string]interface{}) (interface{}, error)
Execute executes a WebAssembly function