Bug 1901523 - Stage and store backup snapshots under backups/snapshots. r=backup-reviewers,kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D213078
This commit is contained in:
Mike Conley
2024-06-22 00:52:40 +00:00
parent 45c44b8ada
commit 7fb7aa2030
2 changed files with 18 additions and 3 deletions

View File

@@ -597,6 +597,16 @@ export class BackupService extends EventTarget {
return "backups";
}
/**
* The name of the folder within the PROFILE_FOLDER_NAME where the staging
* folder / prior backups will be stored.
*
* @type {string}
*/
static get SNAPSHOTS_FOLDER_NAME() {
return "snapshots";
}
/**
* The name of the backup manifest file.
*
@@ -830,13 +840,17 @@ export class BackupService extends EventTarget {
// profile.
let backupDirPath = PathUtils.join(
profilePath,
BackupService.PROFILE_FOLDER_NAME
BackupService.PROFILE_FOLDER_NAME,
BackupService.SNAPSHOTS_FOLDER_NAME
);
lazy.logConsole.debug("Creating backups folder");
// ignoreExisting: true is the default, but we're being explicit that it's
// okay if this folder already exists.
await IOUtils.makeDirectory(backupDirPath, { ignoreExisting: true });
await IOUtils.makeDirectory(backupDirPath, {
ignoreExisting: true,
createAncestors: true,
});
let stagingPath = await this.#prepareStagingFolder(backupDirPath);