backups: add setup/teardown

1. add setup, teardown hooks
2. move the managed mount setup and teardown to filesystem backend
3. remove this vague storage.js

we should convert storageApi into a real object, so we don't have to
keep passing apiConfig around
This commit is contained in:
Girish Ramakrishnan
2025-08-01 14:54:32 +02:00
parent a1a683ec56
commit ea419509f1
14 changed files with 228 additions and 208 deletions
+1 -2
View File
@@ -181,7 +181,6 @@ const appTaskManager = require('./apptaskmanager.js'),
semver = require('semver'),
services = require('./services.js'),
shell = require('./shell.js')('apps'),
storage = require('./storage.js'),
tasks = require('./tasks.js'),
tgz = require('./backupformat/tgz.js'),
TransformStream = require('stream').Transform,
@@ -2838,7 +2837,7 @@ async function getBackupDownloadStream(app, backupId) {
const ps = new PassThrough();
const stream = await storage.api(backupTarget.provider).download(backupTarget.config, tgz.getBackupFilePath(backupTarget, backup.remotePath));
const stream = await backupTargets.storageApi(backupTarget).download(backupTarget.config, tgz.getBackupFilePath(backupTarget, backup.remotePath));
stream.on('error', function(error) {
debug(`getBackupDownloadStream: read stream error: ${error.message}`);
ps.emit('error', new BoxError(BoxError.EXTERNAL_ERROR, error));