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

@ -5,6 +5,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/meta"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/locker"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/mstore"
"github.com/tkw1536/goprogram/stream"
@ -61,3 +62,14 @@ func (barrel Barrel) LastRebuild() (t time.Time, err error) {
func (barrel *Barrel) setLastRebuild() error {
return lastRebuild.Set(barrel.MStore, time.Now().Unix())
}
type LastRebuildFetcher struct {
ingredient.Base
Barrel *Barrel
}
func (lbr *LastRebuildFetcher) Fetch(flags ingredient.FetchFlags, info *ingredient.Information) (err error) {
info.LastRebuild, _ = lbr.Barrel.LastRebuild()
return
}