wisski-cloud-distillery/internal/component/extras/bookkeeping.go
2022-10-02 18:17:47 +02:00

29 lines
826 B
Go

package extras
import (
"fmt"
"io"
"github.com/FAU-CDI/wisski-distillery/internal/component"
"github.com/FAU-CDI/wisski-distillery/internal/models"
)
type Bookkeeping struct {
component.ComponentBase
}
func (Bookkeeping) Name() string { return "bookkeeping" }
// SnapshotNeedsRunning returns if this Snapshotable requires a running instance.
func (Bookkeeping) SnapshotNeedsRunning() bool { return false }
// SnapshotName returns a new name to be used as an argument for path.
func (Bookkeeping) SnapshotName() string { return "bookkeeping.txt" }
// Snapshot creates a snapshot of this instance
func (*Bookkeeping) Snapshot(wisski models.Instance, context component.StagingContext) error {
return context.AddFile(".", func(file io.Writer) error {
_, err := fmt.Fprintf(file, "%#v\n", wisski)
return err
})
}