Create new 'extras' components for management
This commit is contained in:
parent
b6c36b5488
commit
698f04e13e
3 changed files with 29 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
package control
|
package extras
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -6,12 +6,18 @@ import (
|
||||||
"github.com/FAU-CDI/wisski-distillery/internal/component"
|
"github.com/FAU-CDI/wisski-distillery/internal/component"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (*Control) BackupName() string {
|
// Config implements backing up configuration
|
||||||
|
type Config struct {
|
||||||
|
component.ComponentBase
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Config) Name() string { return "extra-config" }
|
||||||
|
|
||||||
|
func (*Config) BackupName() string {
|
||||||
return "config"
|
return "config"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup backups all control plane configuration files into dest
|
func (control *Config) Backup(context component.StagingContext) error {
|
||||||
func (control *Control) Backup(context component.StagingContext) error {
|
|
||||||
files := control.backupFiles()
|
files := control.backupFiles()
|
||||||
|
|
||||||
return context.AddDirectory("", func() error {
|
return context.AddDirectory("", func() error {
|
||||||
|
|
@ -26,7 +32,7 @@ func (control *Control) Backup(context component.StagingContext) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// backupfiles lists the files to be backed up.
|
// backupfiles lists the files to be backed up.
|
||||||
func (control *Control) backupFiles() []string {
|
func (control *Config) backupFiles() []string {
|
||||||
return []string{
|
return []string{
|
||||||
control.Config.ConfigPath,
|
control.Config.ConfigPath,
|
||||||
control.Config.ExecutablePath(),
|
control.Config.ExecutablePath(),
|
||||||
2
internal/component/extras/extras.go
Normal file
2
internal/component/extras/extras.go
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Package extras implements additional components to be used for backups and snapshots
|
||||||
|
package extras
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/FAU-CDI/wisski-distillery/internal/component"
|
"github.com/FAU-CDI/wisski-distillery/internal/component"
|
||||||
"github.com/FAU-CDI/wisski-distillery/internal/component/control"
|
"github.com/FAU-CDI/wisski-distillery/internal/component/control"
|
||||||
|
"github.com/FAU-CDI/wisski-distillery/internal/component/extras"
|
||||||
"github.com/FAU-CDI/wisski-distillery/internal/component/instances"
|
"github.com/FAU-CDI/wisski-distillery/internal/component/instances"
|
||||||
"github.com/FAU-CDI/wisski-distillery/internal/component/snapshots"
|
"github.com/FAU-CDI/wisski-distillery/internal/component/snapshots"
|
||||||
"github.com/FAU-CDI/wisski-distillery/internal/component/sql"
|
"github.com/FAU-CDI/wisski-distillery/internal/component/sql"
|
||||||
|
|
@ -31,6 +32,9 @@ type components struct {
|
||||||
// other components
|
// other components
|
||||||
instances lazy.Lazy[*instances.Instances]
|
instances lazy.Lazy[*instances.Instances]
|
||||||
snapshots lazy.Lazy[*snapshots.Manager]
|
snapshots lazy.Lazy[*snapshots.Manager]
|
||||||
|
|
||||||
|
// extras components
|
||||||
|
extrasConfig lazy.Lazy[*extras.Config]
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -82,6 +86,14 @@ func (dis *Distillery) SnapshotManager() *snapshots.Manager {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// EXTRAS COMPONENTS
|
||||||
|
//
|
||||||
|
|
||||||
|
func (dis *Distillery) ExtrasConfig() *extras.Config {
|
||||||
|
return component.Initialize(dis.Core, &dis.components.extrasConfig, nil)
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ALL COMPONENTS
|
// ALL COMPONENTS
|
||||||
//
|
//
|
||||||
|
|
@ -94,6 +106,10 @@ func (dis *Distillery) Components() []component.Component {
|
||||||
dis.Triplestore(),
|
dis.Triplestore(),
|
||||||
dis.SQL(),
|
dis.SQL(),
|
||||||
dis.Instances(),
|
dis.Instances(),
|
||||||
|
dis.SnapshotManager(),
|
||||||
|
|
||||||
|
// extras components
|
||||||
|
dis.ExtrasConfig(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue