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,9 +7,9 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/templating"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/gorilla/sessions"
"github.com/julienschmidt/httprouter"
"github.com/tkw1536/pkglib/lazy"
)
type Auth struct {

View file

@ -11,7 +11,7 @@ import (
// Components represents a logical subsystem of the distillery.
// A Component should be implemented as a pointer to a struct.
// Every component must embed [Base] and should be initialized using [Init] inside a [lazy.Pool].
// Every component 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.
@ -41,7 +41,7 @@ func (cb *Base) getBase() *Base {
}
// Init initialzes a new componeont Component with the provided still.
// Init is only initended to be used within a lazy.Pool[Component,Still].
// Init is only initended to be used within a lifetime.Lifetime[Component,Still].
func Init(component Component, core Still) Component {
base := component.getBase() // pointer to a struct
base.Still = core

View file

@ -15,8 +15,8 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/assets"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/templating"
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/rs/zerolog"
"github.com/tkw1536/pkglib/lazy"
_ "embed"
)

View file

@ -11,10 +11,10 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/templating"
"github.com/julienschmidt/httprouter"
"github.com/rs/zerolog"
"github.com/tkw1536/pkglib/lifetime"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances"
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
)
type Admin struct {
@ -33,7 +33,7 @@ type Admin struct {
Sockets *socket.Sockets
}
Analytics *lazy.PoolAnalytics
Analytics *lifetime.Analytics
}
var (

View file

@ -12,8 +12,8 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/assets"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/templating"
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/julienschmidt/httprouter"
"github.com/tkw1536/pkglib/lifetime"
)
//go:embed "html/anal.html"
@ -27,7 +27,7 @@ var analTemplate = templating.Parse[analContext](
type analContext struct {
templating.RuntimeFlags
Analytics lazy.PoolAnalytics
Analytics lifetime.Analytics
}
func (admin *Admin) components(ctx context.Context) http.Handler {

View file

@ -9,7 +9,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/templating"
"github.com/FAU-CDI/wisski-distillery/internal/status"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/tkw1536/pkglib/lazy"
)
type Home struct {

View file

@ -2,7 +2,7 @@ package templating
import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/tkw1536/pkglib/lazy"
)
// Templating implements templating customization

View file

@ -7,7 +7,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
"github.com/FAU-CDI/wisski-distillery/pkg/lazy"
"github.com/tkw1536/pkglib/lazy"
)
type SQL struct {