-
Notifications
You must be signed in to change notification settings - Fork 54
Allow restore data from sites in groups backup to different site #4509
Conversation
Current Aviator status
This PR was closed without merging. If you still want to merge this PR, re-open it.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
Kudos, SonarCloud Quality Gate passed!Β Β
|
9e62337
to
4ffa2d4
Compare
4ffa2d4
to
b70e20d
Compare
db4853b
to
04c3d20
Compare
Kudos, SonarCloud Quality Gate passed!Β Β
|
SubServiceType path.ServiceType | ||
SubService string |
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.
Any thoughts on this pattern? Any alternate suggestions?
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.
This seems to duplicate the selector's ownership. Moving these out of there and into the restore config opens up the potential for conflict between these props and the selector. Similarly, it might lead to building this data into the selector downstream anyway. Iirc, the selector already has the capacity to specify the secondary resource; seems like this identification could be owned there instead.
// SubService specifies the sub-service which we are restoring in | ||
// case of services that are constructed out of multiple services | ||
// like Groups. | ||
SubService RestoreConfigSubService |
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.
RestoreConfig
change here.
@@ -197,88 +198,6 @@ func (ctrl *Controller) CacheItemInfo(dii details.ItemInfo) { | |||
} | |||
} | |||
|
|||
// --------------------------------------------------------------------------- |
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.
Move as is to src/internal/m365/service/common/lookup.go
.
|
||
var protectedResource idname.Provider = sel | ||
|
||
// In case of groups, we use the root site as the restore target |
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.
Do we have to make it configurable by caller? I didn't think it was required as this is test code.
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.
Looks functional, but I don't fully agree with the design as it splits ownership across multiple systems (configuration, selection) instead of holding to the current pattern of using selectors to source restore data, which would centralize control within a singular interface.
Separately, this PR has too much going on to easily review. There's a lot of refactoring, plus changes across the cli, operations, and service layers. To review it properly these things need to get split out across several PRs. I'd recommend:
- first: change selectors to best accomodate subservice declaration and identification according to an interface (we may want a design doc for this).
- second: change the operations and service layers to consume the new selectors interface.
- third: expose these changes via the CLI and SDK boundaries.
interpolate large refactors as separate PRs along the way, whenever appropriate.
} | ||
fs.StringVar( | ||
&ToResourceFV, ToResourceFN, "", | ||
"Overrides the protected resource (mailbox, site, user, etc) where data gets restored") |
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.
"Overrides the protected resource (mailbox, site, user, etc) where data gets restored") | |
"Overrides which protected resource (mailbox, site, user, etc) receives the restored data") |
} else if len(opts.WebURL)+len(opts.SiteID) > 1 { | ||
return clues.New("only a single site can be selected for restore") | ||
} | ||
// When restoring the user has to select a single site to |
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.
// When restoring the user has to select a single site to | |
// When restoring, the caller must select a single site to |
} | ||
|
||
if len(opts.WebURL)+len(opts.SiteID) > 1 { | ||
return clues.New("only a single site can be selected when processing sub resources") |
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.
return clues.New("only a single site can be selected when processing sub resources") | |
return clues.New("cannot select multiple sites for this operation") |
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.
I'm not confident that this code belongs in the common package, either at the top level or as a subpackage. Is there a strong reason not to keep it in its current location at this time?
"github.com/alcionai/corso/src/pkg/count" | ||
"github.com/alcionai/corso/src/pkg/fault" | ||
"github.com/alcionai/corso/src/pkg/path" | ||
) | ||
|
||
func (ctrl *Controller) GetRestoreResource( |
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.
func (ctrl *Controller) GetRestoreResource( | |
func (ctrl *Controller) GetResource( |
SubServiceType path.ServiceType | ||
SubService string |
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.
This seems to duplicate the selector's ownership. Moving these out of there and into the restore config opens up the potential for conflict between these props and the selector. Similarly, it might lead to building this data into the selector downstream anyway. Iirc, the selector already has the capacity to specify the secondary resource; seems like this identification could be owned there instead.
@@ -227,7 +227,11 @@ func (op *RestoreOperation) do( | |||
return nil, clues.Wrap(err, "getting backup and details") | |||
} | |||
|
|||
restoreToProtectedResource, err := chooseRestoreResource(ctx, op.rc, op.RestoreCfg, bup.Selector) | |||
restoreService, restoreToProtectedResource, err := op.rc.GetRestoreResource( |
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.
is there a way the selector and this service can differ? Could we remove the service return value and continue to use the value from the selector? Seems like it would be less error prone
Temporarily moving over to implementing exports for email as that has moved up in priority. Will get back to rework this after that. |
Closing this PR. Will create a new PR when revisiting this issue. |
This adds the option restore a site to a different one from the one that it was backed up from.
Does this PR need a docs update or release note?
Type of change
Issue(s)
Test Plan