lxd/backup.go
func backupLoadByName(s *state.State, project, name string) (*backup, error) {
	// Get the backup database record
	args, err := s.Cluster.ContainerGetBackup(project, name)
	if err != nil {
		return nil, errors.Wrap(err, "Load backup from database")
	}

	// Load the container it belongs to
	c, err := containerLoadById(s, args.ContainerID)
	if err != nil {
		return nil, errors.Wrap(err, "Load container from database")
	}

	// Return the backup struct
	return &backup{
		state:            s,
		container:        c,
		id:               args.ID,
		name:             name,
		creationDate:     args.CreationDate,
		expiryDate:       args.ExpiryDate,
		containerOnly:    args.ContainerOnly,
		optimizedStorage: args.OptimizedStorage,
	}, nil
}
func backupLoadByName(s *state.State, project, name string) (*backup, error) {
	// Get the backup database record
	args, err := s.Cluster.ContainerGetBackup(project, name)
	if err != nil {
		return nil, errors.Wrap(err, "Load backup from database")
	}

	// Load the container it belongs to
	c, err := containerLoadById(s, args.ContainerID)
	if err != nil {
		return nil, errors.Wrap(err, "Load container from database")
	}

	// Return the backup struct
	return &backup{
		state:            s,
		container:        c,
		id:               args.ID,
		name:             name,
		creationDate:     args.CreationDate,
		expiryDate:       args.ExpiryDate,
		containerOnly:    args.ContainerOnly,
		optimizedStorage: args.OptimizedStorage,
	}, nil
}
func backupLoadByName ( s * state . State , project , name string ) ( * backup , error ) { // Get the backup database record args , err := s . Cluster . ContainerGetBackup ( project , name ) if err != nil { return nil , errors . Wrap ( err , " " ) } // Load the container it belongs to c , err := containerLoadById ( s , args . ContainerID ) if err != nil { return nil , errors . Wrap ( err , " " ) } // Return the backup struct return & backup { state : s , container : c , id : args . ID , name : name , creationDate : args . CreationDate , expiryDate : args . ExpiryDate , containerOnly : args . ContainerOnly , optimizedStorage : args . OptimizedStorage , } , nil }
// Load a backup from the database
Load a backup from the database