This commit ensures that the compiler has to check every component against the groups they implement by explicitly annotating the appropriate interfaces.
32 lines
855 B
Go
32 lines
855 B
Go
package exporter
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
|
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
|
)
|
|
|
|
type Bookkeeping struct {
|
|
component.Base
|
|
}
|
|
|
|
var (
|
|
_ component.Snapshotable = (*Bookkeeping)(nil)
|
|
)
|
|
|
|
// 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, scontext component.StagingContext) error {
|
|
return scontext.AddFile(".", func(ctx context.Context, file io.Writer) error {
|
|
_, err := fmt.Fprintf(file, "%#v\n", wisski)
|
|
return err
|
|
})
|
|
}
|