Replica.Restore fallback to DB.path
Per the godoc on Replica.Restore and RestoreOptions.OutputPath, Replica.db.path should be used when RestoreOptions.OutputPath is empty. Fixes #233
This commit is contained in:
committed by
Ben Johnson
parent
aa2c684c81
commit
cb33d8c6a9
@@ -980,7 +980,10 @@ func (r *Replica) CalcRestoreTarget(ctx context.Context, opt RestoreOptions) (ge
|
||||
func (r *Replica) Restore(ctx context.Context, opt RestoreOptions) (err error) {
|
||||
// Validate options.
|
||||
if opt.OutputPath == "" {
|
||||
if r.db.path == "" {
|
||||
return fmt.Errorf("output path required")
|
||||
}
|
||||
opt.OutputPath = r.db.path
|
||||
} else if opt.Generation == "" && opt.Index != math.MaxInt32 {
|
||||
return fmt.Errorf("must specify generation when restoring to index")
|
||||
} else if opt.Index != math.MaxInt32 && !opt.Timestamp.IsZero() {
|
||||
|
||||
Reference in New Issue
Block a user