Documentation ¶
Index ¶
- Constants
- func ConfigToInstanceDBArgs(state *state.State, c *config.Config, projectName string, applyProfiles bool) (*db.InstanceArgs, error)
- func ParseConfigYamlFile(path string) (*config.Config, error)
- func TarReader(r io.ReadSeeker, sysOS *sys.OS, outputPath string) (*tar.Reader, context.CancelFunc, error)
- func UpdateInstanceConfig(c *db.Cluster, b Info, mountPath string) error
- type CommonBackup
- type Info
- type Instance
- type InstanceBackup
- type Type
- type VolumeBackup
Constants ¶
const TypeContainer = Type("container")
TypeContainer defines the backup type value for a container.
const TypeCustom = Type("custom")
TypeCustom defines the backup type value for a custom volume.
const TypeUnknown = Type("")
TypeUnknown defines the backup type value for unknown backups.
const TypeVM = Type("virtual-machine")
TypeVM defines the backup type value for a virtual-machine.
const WorkingDirPrefix = "lxd_backup"
WorkingDirPrefix is used when temporary working directories are needed.
Variables ¶
This section is empty.
Functions ¶
func ConfigToInstanceDBArgs ¶
func ConfigToInstanceDBArgs(state *state.State, c *config.Config, projectName string, applyProfiles bool) (*db.InstanceArgs, error)
ConfigToInstanceDBArgs converts the instance config in the backup config to DB InstanceArgs.
func ParseConfigYamlFile ¶
ParseConfigYamlFile decodes the YAML file at path specified into a Config.
Types ¶
type CommonBackup ¶
type CommonBackup struct {
// contains filtered or unexported fields
}
CommonBackup represents a common backup.
func (*CommonBackup) CompressionAlgorithm ¶
func (b *CommonBackup) CompressionAlgorithm() string
CompressionAlgorithm returns the compression used for the tarball.
func (*CommonBackup) Name ¶
func (b *CommonBackup) Name() string
Name returns the name of the backup.
func (*CommonBackup) OptimizedStorage ¶
func (b *CommonBackup) OptimizedStorage() bool
OptimizedStorage returns whether the backup is to be performed using optimization supported by the storage driver.
func (*CommonBackup) SetCompressionAlgorithm ¶
func (b *CommonBackup) SetCompressionAlgorithm(compression string)
SetCompressionAlgorithm sets the tarball compression.
type Info ¶
type Info struct { Project string `json:"-" yaml:"-"` // Project is set during import based on current project. Name string `json:"name" yaml:"name"` Backend string `json:"backend" yaml:"backend"` Pool string `json:"pool" yaml:"pool"` Snapshots []string `json:"snapshots,omitempty" yaml:"snapshots,omitempty"` OptimizedStorage *bool `json:"optimized,omitempty" yaml:"optimized,omitempty"` // Optional field to handle older optimized backups that don't have this field. OptimizedHeader *bool `json:"optimized_header,omitempty" yaml:"optimized_header,omitempty"` // Optional field to handle older optimized backups that don't have this field. Type Type `json:"type,omitempty" yaml:"type,omitempty"` // Type of backup. Config *config.Config `json:"config,omitempty" yaml:"config,omitempty"` // Equivalent of backup.yaml but embedded in index for quick retrieval. }
Info represents exported backup information.
type Instance ¶
type Instance interface { Name() string Project() api.Project Operation() *operations.Operation }
Instance represents the backup relevant subset of a LXD instance. This is used rather than instance.Instance to avoid import loops.
type InstanceBackup ¶
type InstanceBackup struct { CommonBackup // contains filtered or unexported fields }
InstanceBackup represents an instance backup.
func NewInstanceBackup ¶
func NewInstanceBackup(state *state.State, inst Instance, ID int, name string, creationDate time.Time, expiryDate time.Time, instanceOnly bool, optimizedStorage bool) *InstanceBackup
NewInstanceBackup instantiates a new InstanceBackup struct.
func (*InstanceBackup) Delete ¶
func (b *InstanceBackup) Delete() error
Delete removes an instance backup.
func (*InstanceBackup) Instance ¶
func (b *InstanceBackup) Instance() Instance
Instance returns the instance to be backed up.
func (*InstanceBackup) InstanceOnly ¶
func (b *InstanceBackup) InstanceOnly() bool
InstanceOnly returns whether only the instance itself is to be backed up.
func (*InstanceBackup) Rename ¶
func (b *InstanceBackup) Rename(newName string) error
Rename renames an instance backup.
func (*InstanceBackup) Render ¶
func (b *InstanceBackup) Render() *api.InstanceBackup
Render returns an InstanceBackup struct of the backup.
type Type ¶
type Type string
Type indicates the type of backup.
func InstanceTypeToBackupType ¶
func InstanceTypeToBackupType(instanceType api.InstanceType) Type
InstanceTypeToBackupType converts instance type to backup type.
type VolumeBackup ¶
type VolumeBackup struct { CommonBackup // contains filtered or unexported fields }
VolumeBackup represents a custom volume backup.
func NewVolumeBackup ¶
func NewVolumeBackup(state *state.State, projectName, poolName, volumeName string, ID int, name string, creationDate, expiryDate time.Time, volumeOnly, optimizedStorage bool) *VolumeBackup
NewVolumeBackup instantiates a new VolumeBackup struct.
func (*VolumeBackup) OptimizedStorage ¶
func (b *VolumeBackup) OptimizedStorage() bool
OptimizedStorage returns whether the backup is to be performed using optimization format of the storage driver.
func (*VolumeBackup) Rename ¶
func (b *VolumeBackup) Rename(newName string) error
Rename renames a volume backup.
func (*VolumeBackup) Render ¶
func (b *VolumeBackup) Render() *api.StoragePoolVolumeBackup
Render returns a VolumeBackup struct of the backup.
func (*VolumeBackup) VolumeOnly ¶
func (b *VolumeBackup) VolumeOnly() bool
VolumeOnly returns whether only the volume itself is to be backed up.