WIP Reworking data module

This commit is contained in:
2026-02-05 22:55:48 +08:00
parent 9b9d9e2156
commit b3841f5647
10 changed files with 361 additions and 71 deletions

33
pkg/data/component.go Normal file
View File

@@ -0,0 +1,33 @@
package data
import "context"
type Component interface {
Start(ctx context.Context) error
Stop(ctx context.Context) error
ValidateConfig(cfg ComponentConfig) (ComponentConfigValidation, error)
ApplyConfig(cfg ComponentConfig) error
Status() ComponentStatus
}
type ComponentRuntime interface {
OpenStream(id StreamID) (Stream, error)
ReportError(fatal bool, err error)
}
type ComponentStatus struct {
Active bool
Patching bool
Config any
Error error
}
type ComponentConfig any
type ComponentConfigValidation struct {
Valid bool
RequiresRestart bool
Warnings []string
}