component: Rename and simplification
This commit is contained in:
parent
e320bb37bb
commit
f7c8a43844
26 changed files with 99 additions and 101 deletions
|
|
@ -22,7 +22,7 @@ import (
|
|||
)
|
||||
|
||||
// register returns all components of the distillery
|
||||
func (dis *Distillery) register(context component.ComponentPoolContext) []component.Component {
|
||||
func (dis *Distillery) register(context component.PoolContext) []component.Component {
|
||||
return collection.MapSlice([]initFunc{
|
||||
auto[*web.Web],
|
||||
|
||||
|
|
@ -65,16 +65,16 @@ func (dis *Distillery) register(context component.ComponentPoolContext) []compon
|
|||
})
|
||||
}
|
||||
|
||||
type initFunc = func(dis *Distillery, context component.ComponentPoolContext) component.Component
|
||||
type initFunc = func(dis *Distillery, context component.PoolContext) component.Component
|
||||
|
||||
// manual initializes a component from the provided distillery.
|
||||
func manual[C component.Component](init func(component C)) initFunc {
|
||||
return func(dis *Distillery, context component.ComponentPoolContext) component.Component {
|
||||
return component.MakeComponent(context, dis.Still, init)
|
||||
return func(dis *Distillery, context component.PoolContext) component.Component {
|
||||
return component.Make(context, dis.Still, init)
|
||||
}
|
||||
}
|
||||
|
||||
// use is like r, but does not provided additional initialization
|
||||
func auto[C component.Component](dis *Distillery, context component.ComponentPoolContext) component.Component {
|
||||
return component.MakeComponent[C](context, dis.Still, nil)
|
||||
func auto[C component.Component](dis *Distillery, context component.PoolContext) component.Component {
|
||||
return component.Make[C](context, dis.Still, nil)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ type Distillery struct {
|
|||
Upstream Upstream
|
||||
|
||||
// Pool holds all the components in this pool
|
||||
pool component.ComponentPool
|
||||
pool component.Pool
|
||||
}
|
||||
|
||||
// Upstream contains the configuration for accessing remote configuration.
|
||||
|
|
@ -52,7 +52,7 @@ func (dis *Distillery) Context() context.Context {
|
|||
|
||||
// e is a convenience function to export a single component
|
||||
func e[C component.Component](dis *Distillery) C {
|
||||
return component.ExportComponent[C](
|
||||
return component.Export[C](
|
||||
&dis.pool,
|
||||
dis.Still,
|
||||
dis.register,
|
||||
|
|
@ -60,7 +60,7 @@ func e[C component.Component](dis *Distillery) C {
|
|||
}
|
||||
|
||||
func ea[C component.Component](dis *Distillery) []C {
|
||||
return component.ExportComponents[C](
|
||||
return component.ExportAll[C](
|
||||
&dis.pool,
|
||||
dis.Still,
|
||||
dis.register,
|
||||
|
|
|
|||
1
internal/dis/pool.go
Normal file
1
internal/dis/pool.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
package dis
|
||||
Loading…
Add table
Add a link
Reference in a new issue