snapshot

package
v1.0.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterType

type AdapterType string
const (
	LocalBackupAdapter AdapterType = "kuber"
)

type ArchiveDetails

type ArchiveDetails struct {
	Snapcontent string              `json:"snapcontent"`
	Size        int64               `json:"size"`
	Parts       []remote.BackupPart `json:"parts"`
}

func (*ArchiveDetails) ToRequest

func (ad *ArchiveDetails) ToRequest(successful bool) remote.BackupRequest

ToRequest returns a request object.

type Backup

type Backup struct {
	// The UUID of this backup object. This must line up with a backup from
	// the panel instance.
	Uuid string `json:"uuid"`
	// contains filtered or unexported fields
}

func (*Backup) Identifier

func (b *Backup) Identifier() string

func (*Backup) SetClient

func (b *Backup) SetClient(c remote.Client)

type BackupInterface

type BackupInterface interface {
	// SetClient sets the API request client on the backup interface.
	SetClient(remote.Client)
	// Identifier returns the UUID of this backup as tracked by the panel
	// instance.
	Identifier() string
	// WithLogContext attaches additional context to the log output for this
	// backup.
	WithLogContext(map[string]interface{})
	// Generate creates a backup in whatever the configured source for the
	// specific implementation is.
	Generate(context.Context, string, string) (*ArchiveDetails, error)
	// Remove removes a backup file.
	Remove() error
	// Restore is called when a backup is ready to be restored to the disk from
	// the given source. Not every backup implementation will support this nor
	// will every implementation require a reader be provided.
	Restore(context.Context, string, int64, RestoreCallback) error
}

noinspection GoNameStartsWithPackageName

type LocalBackup

type LocalBackup struct {
	Backup
}

func LocateLocal

func LocateLocal(snapshotClient *snapshotclientset.Clientset, client remote.Client, clientset *kubernetes.Clientset, uuid string) (*LocalBackup, error)

LocateLocal finds the backup for a server and returns the local path. This will obviously only work if the backup was created as a local backup.

func NewLocal

func NewLocal(snapshotClient *snapshotclientset.Clientset, client remote.Client, clientset *kubernetes.Clientset, uuid string, ignore string) *LocalBackup

func (*LocalBackup) Generate

func (b *LocalBackup) Generate(ctx context.Context, sid, ignore string) (*ArchiveDetails, error)

Generate generates a backup of the selected files and pushes it to the defined location for this instance.

func (*LocalBackup) Remove

func (b *LocalBackup) Remove() error

Remove removes a snapshot from the system.

func (*LocalBackup) Restore

func (b *LocalBackup) Restore(ctx context.Context, sid string, disk int64, callback RestoreCallback) error

Restore will walk over the archive and call the callback function for each file encountered.

func (*LocalBackup) WithLogContext

func (b *LocalBackup) WithLogContext(c map[string]interface{})

WithLogContext attaches additional context to the log output for this backup.

type RestoreCallback

type RestoreCallback func(file string, info fs.FileInfo, r io.ReadCloser) error

RestoreCallback is a generic restoration callback that exists for both local and remote backups allowing the files to be restored.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL