Documentation
¶
Index ¶
- type AdapterType
- type ArchiveDetails
- type Backup
- type BackupInterface
- type LocalBackup
- func (b *LocalBackup) Generate(ctx context.Context, sid, ignore string) (*ArchiveDetails, error)
- func (b *LocalBackup) Remove() error
- func (b *LocalBackup) Restore(ctx context.Context, sId string, disk int64, storageClass string, ...) error
- func (b *LocalBackup) WithLogContext(c map[string]interface{})
- type RestoreCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 ¶
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, string, 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) *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, storageClass string, 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 ¶
RestoreCallback is a generic restoration callback that exists for both local and remote backups allowing the files to be restored.