34 lines
614 B
Go
34 lines
614 B
Go
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
|
|
}
|