backups: root ~~canal~~ path surgery

remove rootPath and getBackupFilePath from the backup target and
make this backend specific.
This commit is contained in:
Girish Ramakrishnan
2025-08-02 01:46:29 +02:00
parent a01e1bad0f
commit c935744f4c
15 changed files with 378 additions and 373 deletions
+18 -18
View File
@@ -33,11 +33,11 @@ async function getAvailableSize(apiConfig) {
return Number.POSITIVE_INFINITY;
}
async function upload(apiConfig, backupFilePath) {
async function upload(apiConfig, remotePath) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof backupFilePath, 'string');
assert.strictEqual(typeof remotePath, 'string');
debug(`upload: ${backupFilePath}`);
debug(`upload: ${remotePath}`);
const uploadStream = fs.createWriteStream('/dev/null');
@@ -47,40 +47,40 @@ async function upload(apiConfig, backupFilePath) {
};
}
async function exists(apiConfig, backupFilePath) {
async function exists(apiConfig, remotePath) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof backupFilePath, 'string');
assert.strictEqual(typeof remotePath, 'string');
debug(`exists: ${backupFilePath}`);
debug(`exists: ${remotePath}`);
return false;
}
async function download(apiConfig, backupFilePath) {
async function download(apiConfig, remotePath) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof backupFilePath, 'string');
assert.strictEqual(typeof remotePath, 'string');
debug('download: %s', backupFilePath);
debug('download: %s', remotePath);
throw new BoxError(BoxError.NOT_IMPLEMENTED, 'Cannot download from noop backend');
}
async function listDir(apiConfig, dir, batchSize, marker) {
async function listDir(apiConfig, remotePath, batchSize, marker) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof dir, 'string');
assert.strictEqual(typeof remotePath, 'string');
assert.strictEqual(typeof batchSize, 'number');
assert(typeof marker !== 'undefined');
return { entries: [], marker: null };
}
async function copy(apiConfig, oldFilePath, newFilePath, progressCallback) {
async function copy(apiConfig, fromRemotePath, toRemotePath, progressCallback) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof oldFilePath, 'string');
assert.strictEqual(typeof newFilePath, 'string');
assert.strictEqual(typeof fromRemotePath, 'string');
assert.strictEqual(typeof toRemotePath, 'string');
assert.strictEqual(typeof progressCallback, 'function');
debug(`copy: ${oldFilePath} -> ${newFilePath}`);
debug(`copy: ${fromRemotePath} -> ${toRemotePath}`);
}
async function remove(apiConfig, filename) {
@@ -90,12 +90,12 @@ async function remove(apiConfig, filename) {
debug(`remove: ${filename}`);
}
async function removeDir(apiConfig, pathPrefix, progressCallback) {
async function removeDir(apiConfig, remotePathPrefix, progressCallback) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof pathPrefix, 'string');
assert.strictEqual(typeof remotePathPrefix, 'string');
assert.strictEqual(typeof progressCallback, 'function');
debug(`removeDir: ${pathPrefix}`);
debug(`removeDir: ${remotePathPrefix}`);
}
async function cleanup(apiConfig, progressCallback) {