Skip to content

Commit

Permalink
backup/restore: update arguments due to the changes in apis
Browse files Browse the repository at this point in the history
Longhorn 7581

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit authored and innobead committed Jan 10, 2024
1 parent 0490dee commit deb8b18
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion app/cmd/restore_to_file.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"context"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -86,7 +87,7 @@ func restore(url string, concurrentLimit int) error {
ConcurrentLimit: int32(concurrentLimit),
}

if err := backupstore.RestoreDeltaBlockBackup(config); err != nil {
if err := backupstore.RestoreDeltaBlockBackup(context.Background(), config); err != nil {
return err
}

Expand Down
29 changes: 16 additions & 13 deletions pkg/backup/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package backup

import (
"context"
"encoding/json"
"fmt"
"os"
Expand Down Expand Up @@ -169,26 +170,28 @@ func DoBackupRestore(backupURL string, toFile string, concurrentLimit int, resto

log.Infof("Start restoring from %v into snapshot %v", backupURL, toFile)

return backupstore.RestoreDeltaBlockBackup(&backupstore.DeltaRestoreConfig{
BackupURL: backupURL,
DeltaOps: restoreObj,
Filename: toFile,
ConcurrentLimit: int32(concurrentLimit),
})
return backupstore.RestoreDeltaBlockBackup(context.Background(),
&backupstore.DeltaRestoreConfig{
BackupURL: backupURL,
DeltaOps: restoreObj,
Filename: toFile,
ConcurrentLimit: int32(concurrentLimit),
})
}

func DoBackupRestoreIncrementally(url string, deltaFile string, lastRestored string, concurrentLimit int, restoreObj *replica.RestoreStatus) error {
backupURL := util.UnescapeURL(url)

log.Infof("Start incremental restoring from %v into delta file %v", backupURL, deltaFile)

return backupstore.RestoreDeltaBlockBackupIncrementally(&backupstore.DeltaRestoreConfig{
BackupURL: backupURL,
DeltaOps: restoreObj,
LastBackupName: lastRestored,
Filename: deltaFile,
ConcurrentLimit: int32(concurrentLimit),
})
return backupstore.RestoreDeltaBlockBackupIncrementally(context.Background(),
&backupstore.DeltaRestoreConfig{
BackupURL: backupURL,
DeltaOps: restoreObj,
LastBackupName: lastRestored,
Filename: deltaFile,
ConcurrentLimit: int32(concurrentLimit),
})
}

func CreateNewSnapshotMetafile(file string) error {
Expand Down

0 comments on commit deb8b18

Please sign in to comment.