Refactor component/extras into snapshotting

This commit is contained in:
Tom Wiesing 2022-10-04 10:25:51 +02:00
parent 6d9c83c842
commit 6f409be8b2
No known key found for this signature in database
9 changed files with 81 additions and 79 deletions

View file

@ -0,0 +1,24 @@
package snapshots
import (
"github.com/FAU-CDI/wisski-distillery/internal/component"
"github.com/FAU-CDI/wisski-distillery/internal/models"
)
// Filesystem implements snapshotting an instnace filesystem
type Filesystem struct {
component.ComponentBase
}
func (Filesystem) Name() string { return "filesystem" }
// SnapshotNeedsRunning returns if this Snapshotable requires a running instance.
func (Filesystem) SnapshotNeedsRunning() bool { return false }
// SnapshotName returns a new name to be used as an argument for path.
func (Filesystem) SnapshotName() string { return "data" }
// Snapshot creates a snapshot of this instance
func (*Filesystem) Snapshot(wisski models.Instance, context component.StagingContext) error {
return context.CopyDirectory(".", wisski.FilesystemBase)
}