snapshots: Prepare for restructuring

This commit renames the 'wisski' package to 'dis' and prepares the
snapshots component for restructuring.
This commit is contained in:
Tom Wiesing 2022-10-01 19:53:18 +02:00
parent f58920baf4
commit 1dac09bc03
No known key found for this signature in database
12 changed files with 62 additions and 55 deletions

View file

@ -53,7 +53,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
if !bk.StagingOnly {
// regular mode: create a temporary staging directory
logging.LogMessage(context.IOStream, "Creating new snapshot staging directory")
sPath, err = dis.Snapshots().NewStagingDir("")
sPath, err = dis.SnapshotManager().NewStagingDir("")
if err != nil {
return errSnapshotFailed.Wrap(err)
}
@ -65,7 +65,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
// staging mode: use dest as a destination
sPath = bk.Positionals.Dest
if sPath == "" {
sPath, err = dis.Snapshots().NewStagingDir("")
sPath, err = dis.SnapshotManager().NewStagingDir("")
if err != nil {
return errSnapshotFailed.Wrap(err)
}
@ -100,7 +100,7 @@ func (bk backupC) Run(context wisski_distillery.Context) error {
// create the archive path
archivePath := bk.Positionals.Dest
if archivePath == "" {
archivePath = dis.Snapshots().NewArchivePath("")
archivePath = dis.SnapshotManager().NewArchivePath("")
}
// and write everything into it!

View file

@ -4,8 +4,8 @@ import (
"io/fs"
wisski_distillery "github.com/FAU-CDI/wisski-distillery"
"github.com/FAU-CDI/wisski-distillery/internal/component/snapshots"
"github.com/FAU-CDI/wisski-distillery/internal/core"
"github.com/FAU-CDI/wisski-distillery/internal/wisski"
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
"github.com/FAU-CDI/wisski-distillery/pkg/logging"
"github.com/FAU-CDI/wisski-distillery/pkg/targz"
@ -55,7 +55,7 @@ func (bi snapshot) Run(context wisski_distillery.Context) error {
if !bi.StagingOnly {
// regular mode: create a temporary staging directory
logging.LogMessage(context.IOStream, "Creating new snapshot staging directory")
sPath, err = dis.Snapshots().NewStagingDir(instance.Slug)
sPath, err = dis.SnapshotManager().NewStagingDir(instance.Slug)
if err != nil {
return errSnapshotFailed.Wrap(err)
}
@ -67,7 +67,7 @@ func (bi snapshot) Run(context wisski_distillery.Context) error {
// staging mode: use dest as a destination
sPath = bi.Positionals.Dest
if sPath == "" {
sPath, err = dis.Snapshots().NewStagingDir(instance.Slug)
sPath, err = dis.SnapshotManager().NewStagingDir(instance.Slug)
if err != nil {
return errSnapshotFailed.Wrap(err)
}
@ -87,7 +87,7 @@ func (bi snapshot) Run(context wisski_distillery.Context) error {
// take a snapshot into the staging area!
logging.LogOperation(func() error {
sreport := dis.Snapshot(instance, context.IOStream, wisski.SnapshotDescription{
sreport := dis.SnapshotManager().NewSnapshot(instance, context.IOStream, snapshots.SnapshotDescription{
Dest: sPath,
Keepalive: bi.Keepalive,
})
@ -107,7 +107,7 @@ func (bi snapshot) Run(context wisski_distillery.Context) error {
// create the archive path
archivePath := bi.Positionals.Dest
if archivePath == "" {
archivePath = dis.Snapshots().NewArchivePath(instance.Slug)
archivePath = dis.SnapshotManager().NewArchivePath(instance.Slug)
}
// and write everything into it!

View file

@ -70,8 +70,8 @@ func (si systemupdate) Run(context wisski_distillery.Context) error {
for _, d := range []string{
dis.Config.DeployRoot,
dis.Instances().Path(),
dis.Snapshots().StagingPath(),
dis.Snapshots().ArchivePath(),
dis.SnapshotManager().StagingPath(),
dis.SnapshotManager().ArchivePath(),
} {
context.Println(d)
if err := dis.Core.Environment.MkdirAll(d, environment.DefaultDirPerm); err != nil {