backup

package
v0.0.0-...-04e5504 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoBackupDelete

func DoBackupDelete(s *state.State, projectName, backupName, containerName string) error

DoBackupDelete deletes a backup.

func UpdateInstanceConfigStoragePool

func UpdateInstanceConfigStoragePool(c *db.Cluster, b Info, mountPath string) error

UpdateInstanceConfigStoragePool changes the pool information in the backup.yaml to the pool specified in b.Pool.

Types

type Backup

type Backup struct {
	// contains filtered or unexported fields
}

Backup represents a container backup

func New

func New(state *state.State, inst Instance, ID int, name string, creationDate, expiryDate time.Time, instanceOnly, optimizedStorage bool) *Backup

New instantiates a new Backup struct.

func (*Backup) CompressionAlgorithm

func (b *Backup) CompressionAlgorithm() string

CompressionAlgorithm returns the compression used for the tarball.

func (*Backup) Delete

func (b *Backup) Delete() error

Delete removes an instance backup

func (*Backup) InstanceOnly

func (b *Backup) InstanceOnly() bool

InstanceOnly returns whether only the instance itself is to be backed up.

func (*Backup) Name

func (b *Backup) Name() string

Name returns the name of the backup.

func (*Backup) OptimizedStorage

func (b *Backup) OptimizedStorage() bool

OptimizedStorage returns whether the backup is to be performed using optimization supported by the storage driver.

func (*Backup) Rename

func (b *Backup) Rename(newName string) error

Rename renames a container backup

func (*Backup) Render

func (b *Backup) Render() *api.InstanceBackup

Render returns an InstanceBackup struct of the backup.

func (*Backup) SetCompressionAlgorithm

func (b *Backup) SetCompressionAlgorithm(compression string)

SetCompressionAlgorithm sets the tarball compression.

type Info

type Info struct {
	Project          string   `json:"project" yaml:"project"`
	Name             string   `json:"name" yaml:"name"`
	Backend          string   `json:"backend" yaml:"backend"`
	Privileged       bool     `json:"privileged" yaml:"privileged"`
	Pool             string   `json:"pool" yaml:"pool"`
	Snapshots        []string `json:"snapshots,omitempty" yaml:"snapshots,omitempty"`
	OptimizedStorage bool     `json:"-" yaml:"-"`
}

Info represents exported backup information.

func GetInfo

func GetInfo(r io.ReadSeeker) (*Info, error)

GetInfo extracts backup information from a given ReadSeeker.

type Instance

type Instance interface {
	Name() string
	Project() string
}

Instance represents the backup relevant subset of a LXD instance. This is used rather than instance.Instance to avoid import loops.

type InstanceConfig

type InstanceConfig struct {
	Container *api.Instance           `yaml:"container"`
	Snapshots []*api.InstanceSnapshot `yaml:"snapshots"`
	Pool      *api.StoragePool        `yaml:"pool"`
	Volume    *api.StorageVolume      `yaml:"volume"`
}

InstanceConfig represents the config of an instance that can be stored in a backup.yaml file.

func ParseInstanceConfigYamlFile

func ParseInstanceConfigYamlFile(path string) (*InstanceConfig, error)

ParseInstanceConfigYamlFile decodes the YAML file at path specified into an InstanceConfig.

Jump to

Keyboard shortcuts

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