Documentation
¶
Index ¶
- Constants
- type Backup
- type BackupDescription
- type Bookkeeping
- type Config
- type ExportTask
- type Exporter
- func (dis *Exporter) ArchivePath() string
- func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, task ExportTask) (err error)
- func (dis *Exporter) NewArchivePath(prefix string) (path string)
- func (exporter *Exporter) NewBackup(ctx context.Context, progress io.Writer, description BackupDescription) (backup Backup)
- func (exporter *Exporter) NewSnapshot(ctx context.Context, instance *wisski.WissKI, progress io.Writer, ...) (snapshot Snapshot)
- func (dis *Exporter) NewStagingDir(prefix string) (path string, err error)
- func (exporter *Exporter) Parts() []string
- func (dis *Exporter) Path() string
- func (exporter *Exporter) PruneExports(ctx context.Context, progress io.Writer) error
- func (exporter *Exporter) ShouldPrune(modtime time.Time) bool
- func (dis *Exporter) StagingPath() string
- type Filesystem
- type Pathbuilders
- type Snapshot
- func (snapshot *Snapshot) LogEntry() models.Export
- func (s Snapshot) MarshalJSON() ([]byte, error)
- func (snapshot Snapshot) ReportMachine(w io.Writer) error
- func (snapshot Snapshot) ReportPlain(w io.Writer) error
- func (snapshot Snapshot) String() string
- func (s *Snapshot) UnmarshalJSON(data []byte) error
- type SnapshotDescription
- type WithManifest
Constants ¶
const ( ReportPlainPath = "README.txt" ReportMachinePath = "report.json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backup ¶
type Backup struct {
Description BackupDescription
// Start and End Time of the backup
StartTime time.Time
EndTime time.Time
// various error states, which are ignored when creating the snapshot
ErrPanic interface{}
// errors for the various components
ComponentErrors map[string]error
// TODO: Make this proper
ConfigFileErr error
// Snapshots containing instances
InstanceListErr error
InstanceSnapshots []Snapshot
// List of files included
WithManifest
}
Backup describes a backup.
func (Backup) ReportPlain ¶
Report formats a report for this backup, and writes it into Writer.
type BackupDescription ¶
type BackupDescription struct {
Dest string // Destination path
ConcurrentSnapshots int // maximum number of concurrent snapshots
}
BackupDescription provides a description for a backup.
type Bookkeeping ¶
func (*Bookkeeping) Snapshot ¶
func (*Bookkeeping) Snapshot(wisski models.Instance, scontext *component.StagingContext) error
Snapshot creates a snapshot of this instance.
func (Bookkeeping) SnapshotName ¶
func (Bookkeeping) SnapshotName() string
SnapshotName returns a new name to be used as an argument for path.
func (Bookkeeping) SnapshotNeedsRunning ¶
func (Bookkeeping) SnapshotNeedsRunning() bool
SnapshotNeedsRunning returns if this Snapshotable requires a running instance.
type ExportTask ¶
type ExportTask struct {
// Dest is the destination path to write the backup to.
// When empty, this is created automatically in the staging or archive directory.
Dest string
// By default, a .tar.gz file is generated.
// To generated an unpacked directory, set [StagingOnly] to true.
StagingOnly bool
// Parts explicitly lists parts to include inside the snapshot.
// If non-empty, only include parts with the specified names.
// if empty, include all possible components.
Parts []string
// Instance is the instance to generate a snapshot of.
// To generate a backup, leave this to be nil.
Instance *wisski.WissKI
// BackupDescriptions and SnapshotDescriptions further specitfy options for the export.
// The Dest parameter is ignored, and updated automatically.
BackupDescription BackupDescription
SnapshotDescription SnapshotDescription
}
See Exporter.MakeExport.
type Exporter ¶
Exporter manages snapshots and backups.
func (*Exporter) ArchivePath ¶
ArchivePath returns the path to the directory containing all exported archives. Use NewSnapshotArchivePath to generate a path to a new archive in this directory.
func (*Exporter) MakeExport ¶
func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, task ExportTask) (err error)
MakeExport performs an export task as described by flags. Output is directed to the provided io.
func (*Exporter) NewArchivePath ¶
NewArchivePath returns the path to a new archive with the provided prefix. The path is guaranteed to not exist.
func (*Exporter) NewBackup ¶
func (exporter *Exporter) NewBackup(ctx context.Context, progress io.Writer, description BackupDescription) (backup Backup)
New create a new Backup.
func (*Exporter) NewSnapshot ¶
func (exporter *Exporter) NewSnapshot(ctx context.Context, instance *wisski.WissKI, progress io.Writer, desc SnapshotDescription) (snapshot Snapshot)
Snapshot creates a new snapshot of this instance into dest.
func (*Exporter) NewStagingDir ¶
NewStagingDir returns the path to a new snapshot directory. The directory is guaranteed to have been freshly created.
func (*Exporter) PruneExports ¶
Prune prunes all old exports. TODO: Don't call this automatically!
func (*Exporter) ShouldPrune ¶
ShouldPrune determines if a file with the provided modification time should be removed from the export log.
func (*Exporter) StagingPath ¶
StagingPath returns the path to the directory containing a temporary staging area for snapshots. Use NewSnapshotStagingDir to generate a new staging area.
type Filesystem ¶
Filesystem implements snapshotting an instnace filesystem.
func (*Filesystem) Snapshot ¶
func (*Filesystem) Snapshot(wisski models.Instance, context *component.StagingContext) error
Snapshot creates a snapshot of this instance.
func (Filesystem) SnapshotName ¶
func (Filesystem) SnapshotName() string
SnapshotName returns a new name to be used as an argument for path.
func (Filesystem) SnapshotNeedsRunning ¶
func (Filesystem) SnapshotNeedsRunning() bool
SnapshotNeedsRunning returns if this Snapshotable requires a running instance.
type Pathbuilders ¶
func (*Pathbuilders) Snapshot ¶
func (pbs *Pathbuilders) Snapshot(wisski models.Instance, scontext *component.StagingContext) error
func (Pathbuilders) SnapshotName ¶
func (Pathbuilders) SnapshotName() string
func (Pathbuilders) SnapshotNeedsRunning ¶
func (Pathbuilders) SnapshotNeedsRunning() bool
type Snapshot ¶
type Snapshot struct {
Description SnapshotDescription
Instance models.Instance
// Start and End Time of the snapshot
StartTime time.Time
EndTime time.Time
// Generic Panic that may have occured
ErrPanic interface{}
ErrStart error
ErrStop error
// Errors holds errors for each component
Errors map[string]error
// Logs contains logfiles for each component
Logs map[string]string
// List of files included
WithManifest
// contains filtered or unexported fields
}
Snapshot represents the result of generating a snapshot.
func (Snapshot) MarshalJSON ¶
func (*Snapshot) UnmarshalJSON ¶
type SnapshotDescription ¶
type SnapshotDescription struct {
Dest string // destination path
Keepalive bool // should we keep the instance alive while making the snapshot?
Parts []string // SnapshotName()s of the components to include.
}
SnapshotDescription is a description for a snapshot.
type WithManifest ¶
type WithManifest struct {
Manifest []string
}