refactor: Phase 3 — async backup wrappers (#358)#359
Closed
JusterZhu wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds async wrappers for StorageManager backup operations as part of the GeneralUpdate v2 refactoring plan (Phase 3), enabling callers to invoke backup/restore/cleanup without blocking the calling thread.
Changes:
- Introduces
StorageManager.BackupAsync,RestoreAsync, andCleanBackupAsyncwrappers. - Each async wrapper delegates to the existing synchronous implementation via
Task.Run.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+234
to
+248
|
|
||
| public static async System.Threading.Tasks.Task BackupAsync(string sourcePath, string backupPath, System.Collections.Generic.IReadOnlyList<string> directoryNames) | ||
| { | ||
| await System.Threading.Tasks.Task.Run(() => Backup(sourcePath, backupPath, directoryNames)).ConfigureAwait(false); | ||
| } | ||
|
|
||
| public static async System.Threading.Tasks.Task RestoreAsync(string backupPath, string sourcePath) | ||
| { | ||
| await System.Threading.Tasks.Task.Run(() => Restore(backupPath, sourcePath)).ConfigureAwait(false); | ||
| } | ||
|
|
||
| public static async System.Threading.Tasks.Task CleanBackupAsync(string installPath, int keepVersions = 3) | ||
| { | ||
| await System.Threading.Tasks.Task.Run(() => CleanBackup(installPath, keepVersions)).ConfigureAwait(false); | ||
| } #endregion |
| public static async System.Threading.Tasks.Task CleanBackupAsync(string installPath, int keepVersions = 3) | ||
| { | ||
| await System.Threading.Tasks.Task.Run(() => CleanBackup(installPath, keepVersions)).ConfigureAwait(false); | ||
| } #endregion |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds async wrappers for StorageManager backup operations, as specified in section 2.3 of the v2 plan.
Changes
Note
Full solution: 0 errors
Partial #358