internal/component => internal/dis/component
This commit is contained in:
parent
9443217441
commit
b5b1ce2340
123 changed files with 76 additions and 76 deletions
44
internal/dis/component/installable.go
Normal file
44
internal/dis/component/installable.go
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package component
|
||||
|
||||
import (
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/tkw1536/goprogram/stream"
|
||||
)
|
||||
|
||||
// Installable implements an installable component.
|
||||
type Installable interface {
|
||||
Component
|
||||
|
||||
// Path returns the path this component is installed at.
|
||||
// By convention it is /var/www/deploy/internal/core/${Name()}
|
||||
Path() string
|
||||
|
||||
// Stack can be used to gain access to the "docker compose" stack.
|
||||
//
|
||||
// This should internally call [ComponentBase.MakeStack]
|
||||
Stack(env environment.Environment) StackWithResources
|
||||
|
||||
// Context returns a new InstallationContext to be used during installation from the command line.
|
||||
// Typically this should just pass through the parent, but might perform other tasks.
|
||||
Context(parent InstallationContext) InstallationContext
|
||||
}
|
||||
|
||||
// MakeStack registers the Installable as a stack
|
||||
func MakeStack(component Installable, env environment.Environment, stack StackWithResources) StackWithResources {
|
||||
stack.Env = env
|
||||
stack.Dir = component.Path()
|
||||
return stack
|
||||
}
|
||||
|
||||
// Updatable represents a component with an Update method.
|
||||
type Updatable interface {
|
||||
Component
|
||||
|
||||
// Update updates or initializes the provided components.
|
||||
// It is called after the component has been installed (if applicable).
|
||||
//
|
||||
// It may send output to the provided stream.
|
||||
//
|
||||
// Updating should be idempotent, meaning running it multiple times must not break the existing system.
|
||||
Update(stream stream.IOStream) error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue