feat: moved cli to registry

This commit is contained in:
2026-02-06 23:42:19 -05:00
parent 58d0823069
commit a2355fcd56
9 changed files with 53 additions and 89 deletions

View File

@@ -0,0 +1,36 @@
package registry
import (
"fmt"
"git.maximhutz.com/max/lambda/pkg/engine"
)
type Engine interface {
Load() Process
Name() string
InType() string
}
type convertedEngine[T any] struct {
engine engine.Engine[T]
name string
inType string
}
func (e convertedEngine[T]) InType() string { return e.inType }
func (e convertedEngine[T]) Name() string { return e.name }
func (e convertedEngine[T]) Load() Process {
return convertedProcess[T]{e.engine.Load(), e.inType}
}
func RegisterEngine[T any](registry *Registry, e engine.Engine[T], name, inType string) error {
if _, ok := registry.engines[name]; ok {
return fmt.Errorf("engine '%s' already registered", name)
}
registry.engines[name] = &convertedEngine[T]{e, name, inType}
return nil
}