switch modules to accept an InputHandler instead of the full router

This commit is contained in:
Joel Wetzell
2026-05-20 21:03:41 -05:00
parent be0b1c4a5f
commit 4cedd58a76
31 changed files with 301 additions and 297 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ import (
type Module interface {
Id() string
Type() string
Start(context.Context, RouteIO) error
Start(context.Context, InputHandler) error
Stop()
}
+5 -5
View File
@@ -1,9 +1,9 @@
package common
type WrappedPayload struct {
Payload any
Router RouteIO
Modules map[string]Module
Source string
End bool
Payload any
InputHandler InputHandler
Modules map[string]Module
Source string
End bool
}
+1 -3
View File
@@ -4,9 +4,7 @@ import (
"context"
)
type RouteIO interface {
HandleInput(ctx context.Context, sourceId string, payload any) (bool, []RouteIOError)
}
type InputHandler func(ctx context.Context, sourceId string, payload any) (bool, []RouteIOError)
type RouteIOError struct {
Index int `json:"index"`