This commit is contained in:
2025-08-31 17:01:07 -04:00
parent 66b114f374
commit e3e6a4460b
11 changed files with 600 additions and 101 deletions

View File

@ -8,20 +8,26 @@ import (
"github.com/google/uuid"
)
// LogStreamCallback is a function that can be called to stream logs during execution
type LogStreamCallback func(logs []string) error
// RuntimeBackend provides function execution capabilities
type RuntimeBackend interface {
// Execute runs a function with given input
Execute(ctx context.Context, function *domain.FunctionDefinition, input json.RawMessage) (*domain.ExecutionResult, error)
// ExecuteWithLogStreaming runs a function with given input and streams logs during execution
ExecuteWithLogStreaming(ctx context.Context, function *domain.FunctionDefinition, input json.RawMessage, logCallback LogStreamCallback) (*domain.ExecutionResult, error)
// Deploy prepares function for execution
Deploy(ctx context.Context, function *domain.FunctionDefinition) error
// Remove cleans up function resources
Remove(ctx context.Context, functionID uuid.UUID) error
// GetLogs retrieves execution logs
GetLogs(ctx context.Context, executionID uuid.UUID) ([]string, error)
// HealthCheck verifies runtime availability
HealthCheck(ctx context.Context) error
@ -37,11 +43,11 @@ type RuntimeBackend interface {
// RuntimeInfo contains runtime backend information
type RuntimeInfo struct {
Type string `json:"type"`
Version string `json:"version"`
Available bool `json:"available"`
Endpoint string `json:"endpoint,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Type string `json:"type"`
Version string `json:"version"`
Available bool `json:"available"`
Endpoint string `json:"endpoint,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
// ContainerInfo contains information about a running container
@ -59,4 +65,4 @@ type RuntimeFactory interface {
CreateRuntime(ctx context.Context, runtimeType string, config map[string]interface{}) (RuntimeBackend, error)
GetSupportedRuntimes() []string
GetDefaultConfig(runtimeType string) map[string]interface{}
}
}