From ad3508106676067e66261bfa2cb2eea0e10d1b47 Mon Sep 17 00:00:00 2001 From: Alexander Marshalov <_@marshalov.org> Date: Tue, 16 May 2023 14:21:56 +0200 Subject: [PATCH] backup metadata are written in separate file (#560) Signed-off-by: Alexander Marshalov <_@marshalov.org> --- lib/backup/actions/backup.go | 6 +++++- lib/backup/fscommon/fscommon.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/backup/actions/backup.go b/lib/backup/actions/backup.go index 5c6c80df96..108cd36307 100644 --- a/lib/backup/actions/backup.go +++ b/lib/backup/actions/backup.go @@ -79,6 +79,10 @@ func (b *Backup) Run() error { if err := storeMetadata(src, dst); err != nil { return fmt.Errorf("cannot store backup metadata: %w", err) } + if err := dst.CreateFile(fscommon.BackupCompleteFilename, []byte{}); err != nil { + return fmt.Errorf("cannot create `backup complete` file at %s: %w", dst, err) + } + return nil } @@ -99,7 +103,7 @@ func storeMetadata(src *fslocal.FS, dst common.RemoteFS) error { return fmt.Errorf("cannot marshal metadata: %w", err) } - if err := dst.CreateFile(fscommon.BackupCompleteFilename, metadata); err != nil { + if err := dst.CreateFile(fscommon.BackupMetadataFilename, metadata); err != nil { return fmt.Errorf("cannot create `backup complete` file at %s: %w", dst, err) } diff --git a/lib/backup/fscommon/fscommon.go b/lib/backup/fscommon/fscommon.go index 8897cc6b8b..f76eb81ce7 100644 --- a/lib/backup/fscommon/fscommon.go +++ b/lib/backup/fscommon/fscommon.go @@ -235,3 +235,6 @@ func IgnorePath(path string) bool { // BackupCompleteFilename is a filename, which is created in the destination fs when backup is complete. const BackupCompleteFilename = "backup_complete.ignore" + +// BackupMetadataFilename is a filename, which contains metadata for the backup. +const BackupMetadataFilename = "backup_metadata.ignore"