ingredient/info: Add Fetcher concept

This commit is contained in:
Tom Wiesing 2022-10-19 10:50:40 +02:00
parent a6501b42c7
commit 52559e4d68
No known key found for this signature in database
22 changed files with 447 additions and 328 deletions

View file

@ -1,6 +1,9 @@
package barrel
import "github.com/tkw1536/goprogram/stream"
import (
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
"github.com/tkw1536/goprogram/stream"
)
// Running checks if this WissKI is currently running.
func (barrel *Barrel) Running() (bool, error) {
@ -10,3 +13,14 @@ func (barrel *Barrel) Running() (bool, error) {
}
return len(ps) > 0, nil
}
type RunningFetcher struct {
ingredient.Base
Barrel *Barrel
}
func (rf *RunningFetcher) Fetch(flags ingredient.FetchFlags, info *ingredient.Information) (err error) {
info.Running, err = rf.Barrel.Running()
return
}