CompleteBackup will finalize a backup by writing the manifest at the backup destination.
(ctx context.Context, m *Manifest)
| 707 | |
| 708 | // CompleteBackup will finalize a backup by writing the manifest at the backup destination. |
| 709 | func (pr *BackupProcessor) CompleteBackup(ctx context.Context, m *Manifest) error { |
| 710 | if err := ctx.Err(); err != nil { |
| 711 | return err |
| 712 | } |
| 713 | uri, err := url.Parse(pr.Request.Destination) |
| 714 | if err != nil { |
| 715 | return err |
| 716 | } |
| 717 | handler, err := NewUriHandler(uri, GetCredentialsFromRequest(pr.Request)) |
| 718 | if err != nil { |
| 719 | return err |
| 720 | } |
| 721 | |
| 722 | manifest, err := GetManifestNoUpgrade(handler, uri) |
| 723 | if err != nil { |
| 724 | return err |
| 725 | } |
| 726 | manifest.Manifests = append(manifest.Manifests, m) |
| 727 | |
| 728 | if err := CreateManifest(handler, uri, manifest); err != nil { |
| 729 | return errors.Wrap(err, "complete backup failed") |
| 730 | } |
| 731 | // Best-effort: write summary manifest. Failure does not abort the backup. |
| 732 | if err := CreateManifestSummary(handler, manifest); err != nil { |
| 733 | glog.Warningf("Failed to write backup summary manifest (non-fatal): %v", err) |
| 734 | } |
| 735 | glog.Infof("Backup completed OK.") |
| 736 | return nil |
| 737 | } |
| 738 | |
| 739 | // GoString implements the GoStringer interface for Manifest. |
| 740 | func (m *Manifest) GoString() string { |
no test coverage detected