Migrate pkg/lazy => pkglib/{lazy,lifetime}

This commit is contained in:
Tom Wiesing 2023-02-26 10:00:47 +01:00
parent c3ca8e2974
commit 5e89fadeeb
No known key found for this signature in database
21 changed files with 54 additions and 612 deletions

View file

@ -7,7 +7,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/status"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient/php"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/tkw1536/pkglib/lifetime"
"golang.org/x/sync/errgroup"
)
@ -18,7 +18,7 @@ type Info struct {
Fetchers []ingredient.WissKIFetcher
}
Analytics *lazy.PoolAnalytics
Analytics *lifetime.Analytics
}
var (

View file

@ -9,7 +9,7 @@ import (
// Ingredients represent a part of a WissKI instance.
// An Ingredient should be implemented as a pointer to a struct.
// Every ingredient must embed [Base] and should be initialized using [Init] inside a [lazy.Pool].
// Every ingredient must embed [Base] and should be initialized using [Init] inside a [lifetime.Lifetime].
//
// By convention these are defined within their corresponding subpackage.
// This subpackage also contains all required resources.
@ -35,7 +35,7 @@ func (cb *Base) getBase() *Base {
}
// Init initializes a new Ingredient.
// Init is only intended to be used within a lazy.Pool[Ingredient,*Liquid].
// Init is only intended to be used within a lifetime.Lifetime[Ingredient,*Liquid].
func Init(ingredient Ingredient, liquid *liquid.Liquid) Ingredient {
base := ingredient.getBase() // pointer to a struct
base.Liquid = liquid