rename backups to backuptargets
This commit is contained in:
18
src/apps.js
18
src/apps.js
@@ -152,7 +152,7 @@ const appTaskManager = require('./apptaskmanager.js'),
|
||||
archives = require('./archives.js'),
|
||||
assert = require('assert'),
|
||||
backupListing = require('./backuplisting.js'),
|
||||
backups = require('./backups.js'),
|
||||
backupTargets = require('./backuptargets.js'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
constants = require('./constants.js'),
|
||||
{ CronTime } = require('cron'),
|
||||
@@ -1259,7 +1259,7 @@ async function scheduleTask(appId, installationState, taskId, auditSource) {
|
||||
assert.strictEqual(typeof taskId, 'string');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
const backupConfig = await backups.getConfig();
|
||||
const backupConfig = await backupTargets.getConfig();
|
||||
|
||||
let memoryLimit = 400;
|
||||
if (installationState === exports.ISTATE_PENDING_CLONE || installationState === exports.ISTATE_PENDING_RESTORE
|
||||
@@ -2359,19 +2359,19 @@ async function importApp(app, data, auditSource) {
|
||||
let restoreConfig;
|
||||
|
||||
if (data.remotePath) { // if not provided, we import in-place
|
||||
error = backups.validateFormat(backupFormat);
|
||||
error = backupTargets.validateFormat(backupFormat);
|
||||
if (error) throw error;
|
||||
|
||||
if ('password' in backupConfig) {
|
||||
backupConfig.encryption = backups.generateEncryptionKeysSync(backupConfig.password);
|
||||
backupConfig.encryption = backupTargets.generateEncryptionKeysSync(backupConfig.password);
|
||||
delete backupConfig.password;
|
||||
} else {
|
||||
backupConfig.encryption = null;
|
||||
}
|
||||
|
||||
await backups.setupManagedStorage(backupConfig, `/mnt/appimport-${app.id}`); // this validates mountOptions . this is not cleaned up, it's fine
|
||||
backupConfig.rootPath = backups.getRootPath(backupConfig, `/mnt/appimport-${app.id}`);
|
||||
error = await backups.testStorage(Object.assign({ mountPath: `/mnt/appimport-${app.id}` }, backupConfig)); // this validates provider and it's api options. requires mountPath
|
||||
await backupTargets.setupManagedStorage(backupConfig, `/mnt/appimport-${app.id}`); // this validates mountOptions . this is not cleaned up, it's fine
|
||||
backupConfig.rootPath = backupTargets.getRootPath(backupConfig, `/mnt/appimport-${app.id}`);
|
||||
error = await backupTargets.testStorage(Object.assign({ mountPath: `/mnt/appimport-${app.id}` }, backupConfig)); // this validates provider and it's api options. requires mountPath
|
||||
if (error) throw error;
|
||||
|
||||
restoreConfig = { remotePath, backupFormat, backupConfig };
|
||||
@@ -2780,7 +2780,7 @@ async function backup(app, auditSource) {
|
||||
|
||||
const taskId = await tasks.add(`${tasks.TASK_APP_BACKUP_PREFIX}${app.id}`, [ app.id, { snapshotOnly: false } ]);
|
||||
|
||||
const backupConfig = await backups.getConfig();
|
||||
const backupConfig = await backupTargets.getConfig();
|
||||
const memoryLimit = backupConfig.limits?.memoryLimit ? Math.max(backupConfig.limits.memoryLimit/1024/1024, 1024) : 1024;
|
||||
|
||||
// background
|
||||
@@ -2830,7 +2830,7 @@ async function getBackupDownloadStream(app, backupId) {
|
||||
if (backup.identifier !== app.id) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found'); // some other app's backup
|
||||
if (backup.format !== 'tgz') throw new BoxError(BoxError.BAD_STATE, 'only tgz backups can be downloaded');
|
||||
|
||||
const backupConfig = await backups.getConfig();
|
||||
const backupConfig = await backupTargets.getConfig();
|
||||
|
||||
const ps = new PassThrough();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user