WIP Reworking data module
This commit is contained in:
33
pkg/data/component.go
Normal file
33
pkg/data/component.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user