-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FMWK-570 Add backup state/continuation for backup/restore operation #158
Open
filkeith
wants to merge
25
commits into
main
Choose a base branch
from
FMWK-570-backup-restore-state
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,528
−220
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7026e71
FMWK-570-backup-restore-state
filkeith adf5d05
FMWK-570-backup-restore-state
filkeith 77cd6f3
FMWK-570-backup-restore-state
filkeith a11e874
FMWK-570-backup-restore-state
filkeith 2d87705
FMWK-570-backup-restore-state
filkeith edfcae2
FMWK-570-backup-restore-state
filkeith 81d4774
FMWK-570-backup-restore-state
filkeith 8dcf706
not working
filkeith 8df3cf9
working prorotype
filkeith c4750c0
FMWK-570-backup-restore-state
filkeith d6cc1e6
FMWK-570-backup-restore-state
filkeith 3981aa8
FMWK-570-backup-restore-state
filkeith 547b045
FMWK-570-backup-restore-state
filkeith 9adb40c
FMWK-570-backup-restore-state
filkeith 423a71c
FMWK-570-backup-restore-state
filkeith f1d65dd
FMWK-570-backup-restore-state
filkeith 2b91644
FMWK-570-backup-restore-state
filkeith dba8c86
FMWK-570-backup-restore-state
filkeith 6be5db5
FMWK-570-backup-restore-state
filkeith ac8f6d3
FMWK-570-backup-restore-state
filkeith 11e1371
FMWK-570-backup-restore-state
filkeith b825da9
FMWK-570-backup-restore-state
filkeith f43e4e4
FMWK-570-backup-restore-state
filkeith c7b80f3
FMWK-570-backup-restore-state
filkeith 5fe36ed
FMWK-570-backup-restore-state
filkeith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,11 +26,16 @@ import ( | |
"github.com/aerospike/backup-go/io/local" | ||
) | ||
|
||
func newLocalReader(r *models.Restore, c *models.Common) (backup.StreamingReader, error) { | ||
func newLocalReader(r *models.Restore, c *models.Common, b *models.Backup) (backup.StreamingReader, error) { | ||
var opts []local.Opt | ||
|
||
if c.Directory != "" && r.InputFile == "" { | ||
opts = append(opts, local.WithDir(c.Directory), local.WithValidator(asb.NewValidator())) | ||
opts = append(opts, local.WithDir(c.Directory)) | ||
// Append Validator only if backup params are not set. | ||
// That means we don't need to check that we are saving a state file. | ||
if b == nil { | ||
opts = append(opts, local.WithValidator(asb.NewValidator())) | ||
} | ||
Comment on lines
+34
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider taking this block to a method and reuse. |
||
} | ||
|
||
if r.InputFile != "" && c.Directory == "" { | ||
|
@@ -45,6 +50,7 @@ func newS3Reader( | |
a *models.AwsS3, | ||
r *models.Restore, | ||
c *models.Common, | ||
b *models.Backup, | ||
) (backup.StreamingReader, error) { | ||
client, err := newS3Client(ctx, a) | ||
if err != nil { | ||
|
@@ -57,7 +63,12 @@ func newS3Reader( | |
|
||
if c.Directory != "" && r.InputFile == "" { | ||
bucketName, path = getBucketFromPath(c.Directory) | ||
opts = append(opts, s3.WithDir(path), s3.WithValidator(asb.NewValidator())) | ||
opts = append(opts, s3.WithDir(path)) | ||
// Append Validator only if backup params are not set. | ||
// That means we don't need to check that we are saving a state file. | ||
if b == nil { | ||
opts = append(opts, s3.WithValidator(asb.NewValidator())) | ||
} | ||
} | ||
|
||
if r.InputFile != "" && c.Directory == "" { | ||
|
@@ -73,6 +84,7 @@ func newGcpReader( | |
g *models.GcpStorage, | ||
r *models.Restore, | ||
c *models.Common, | ||
b *models.Backup, | ||
) (backup.StreamingReader, error) { | ||
client, err := newGcpClient(ctx, g) | ||
if err != nil { | ||
|
@@ -82,7 +94,12 @@ func newGcpReader( | |
opts := make([]storage.Opt, 0) | ||
|
||
if c.Directory != "" && r.InputFile == "" { | ||
opts = append(opts, storage.WithDir(c.Directory), storage.WithValidator(asb.NewValidator())) | ||
opts = append(opts, storage.WithDir(c.Directory)) | ||
// Append Validator only if backup params are not set. | ||
// That means we don't need to check that we are saving a state file. | ||
if b == nil { | ||
opts = append(opts, storage.WithValidator(asb.NewValidator())) | ||
} | ||
} | ||
|
||
if r.InputFile != "" && c.Directory == "" { | ||
|
@@ -97,6 +114,7 @@ func newAzureReader( | |
a *models.AzureBlob, | ||
r *models.Restore, | ||
c *models.Common, | ||
b *models.Backup, | ||
) (backup.StreamingReader, error) { | ||
client, err := newAzureClient(a) | ||
if err != nil { | ||
|
@@ -106,7 +124,12 @@ func newAzureReader( | |
opts := make([]blob.Opt, 0) | ||
|
||
if c.Directory != "" && r.InputFile == "" { | ||
opts = append(opts, blob.WithDir(c.Directory), blob.WithValidator(asb.NewValidator())) | ||
opts = append(opts, blob.WithDir(c.Directory)) | ||
// Append Validator only if backup params are not set. | ||
// That means we don't need to check that we are saving a state file. | ||
if b == nil { | ||
opts = append(opts, blob.WithValidator(asb.NewValidator())) | ||
} | ||
} | ||
|
||
if r.InputFile != "" && c.Directory == "" { | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we add this line to the usage output?