no need for format specific getBackupFilePath
This commit is contained in:
@@ -16,16 +16,6 @@ const assert = require('assert'),
|
||||
tar = require('tar-stream'),
|
||||
zlib = require('zlib');
|
||||
|
||||
function getBackupFilePath(backupTarget, remotePath) {
|
||||
assert.strictEqual(typeof backupTarget, 'object');
|
||||
assert.strictEqual(typeof remotePath, 'string');
|
||||
|
||||
// we don't have a rootPath for noop
|
||||
if (backupTarget.provider === 'noop') return remotePath;
|
||||
|
||||
return path.join(backupTarget.config.rootPath, remotePath);
|
||||
}
|
||||
|
||||
// In tar, the entry header contains the file size. If we don't provide it those many bytes, the tar will become corrupt
|
||||
// Linux provides no guarantee of how many bytes can be read from a file. This is the case with sqlite and log files
|
||||
// which are accessed by other processes when tar is in action. This class handles overflow and underflow
|
||||
@@ -236,7 +226,7 @@ async function download(backupTarget, remotePath, dataLayout, progressCallback)
|
||||
|
||||
debug(`download: Downloading ${remotePath} to ${dataLayout.toString()}`);
|
||||
|
||||
const backupFilePath = getBackupFilePath(backupTarget, remotePath);
|
||||
const backupFilePath = backupTargets.getBackupFilePath(backupTarget, remotePath);
|
||||
|
||||
await promiseRetry({ times: 5, interval: 20000, debug }, async () => {
|
||||
progressCallback({ message: `Downloading backup ${backupFilePath}` });
|
||||
@@ -254,7 +244,7 @@ async function upload(backupTarget, remotePath, dataLayout, progressCallback) {
|
||||
|
||||
debug(`upload: Uploading ${dataLayout.toString()} to ${remotePath}`);
|
||||
|
||||
const backupFilePath = getBackupFilePath(backupTarget, remotePath);
|
||||
const backupFilePath = backupTargets.getBackupFilePath(backupTarget, remotePath);
|
||||
|
||||
await promiseRetry({ times: 5, interval: 20000, debug }, async () => {
|
||||
progressCallback({ message: `Uploading backup ${backupFilePath}` });
|
||||
@@ -265,7 +255,6 @@ async function upload(backupTarget, remotePath, dataLayout, progressCallback) {
|
||||
}
|
||||
|
||||
exports = module.exports = {
|
||||
getBackupFilePath,
|
||||
download,
|
||||
upload,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user