diff --git a/src/backupformat/rsync.js b/src/backupformat/rsync.js index cd3ae4f76..0e2e528ef 100644 --- a/src/backupformat/rsync.js +++ b/src/backupformat/rsync.js @@ -27,7 +27,7 @@ function getBackupFilePath(backupConfig, remotePath) { assert.strictEqual(typeof backupConfig, 'object'); assert.strictEqual(typeof remotePath, 'string'); - const rootPath = storage.api(backupConfig.provider).getRootPath(backupConfig); + const rootPath = storage.api(backupConfig.provider).getBackupRootPath(backupConfig); return path.join(rootPath, remotePath); } diff --git a/src/backupformat/tgz.js b/src/backupformat/tgz.js index d29e84378..8e0139589 100644 --- a/src/backupformat/tgz.js +++ b/src/backupformat/tgz.js @@ -23,7 +23,7 @@ function getBackupFilePath(backupConfig, remotePath) { assert.strictEqual(typeof backupConfig, 'object'); assert.strictEqual(typeof remotePath, 'string'); - const rootPath = storage.api(backupConfig.provider).getRootPath(backupConfig); + const rootPath = storage.api(backupConfig.provider).getBackupRootPath(backupConfig); const fileType = backupConfig.encryption ? '.tar.gz.enc' : '.tar.gz'; return path.join(rootPath, remotePath + fileType); diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index f3f7692cd..be635f184 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -1,7 +1,7 @@ 'use strict'; exports = module.exports = { - getRootPath, + getBackupRootPath, checkBackupPreconditions, upload, @@ -45,7 +45,7 @@ const assert = require('assert'), shell = require('../shell.js'); // storage api -function getRootPath(apiConfig) { +function getBackupRootPath(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); switch (apiConfig.provider) { @@ -77,7 +77,7 @@ async function checkBackupPreconditions(apiConfig, dataLayout) { assert.strictEqual(typeof apiConfig, 'object'); assert(dataLayout instanceof DataLayout, 'dataLayout must be a DataLayout'); - const [error, rootPath] = await safe(df.file(getRootPath(apiConfig))); + const [error, rootPath] = await safe(df.file(getBackupRootPath(apiConfig))); if (error) throw new BoxError(BoxError.FS_ERROR, `Error when checking for disk space: ${error.message}`); // Check filesystem is mounted so we don't write into the actual folder on disk @@ -308,7 +308,7 @@ async function testConfig(apiConfig) { if (!safe.child_process.execSync(`mountpoint -q -- ${apiConfig.mountPoint}`)) throw new BoxError(BoxError.BAD_FIELD, `${apiConfig.mountPoint} is not mounted`); } - const basePath = getRootPath(apiConfig); + const basePath = getBackupRootPath(apiConfig); const field = apiConfig.provider === PROVIDER_FILESYSTEM ? 'backupFolder' : 'mountPoint'; if (!safe.fs.mkdirSync(path.join(basePath, 'snapshot'), { recursive: true }) && safe.error.code !== 'EEXIST') { diff --git a/src/storage/gcs.js b/src/storage/gcs.js index e2092bf3c..9589a88e0 100644 --- a/src/storage/gcs.js +++ b/src/storage/gcs.js @@ -1,7 +1,7 @@ 'use strict'; exports = module.exports = { - getRootPath, + getBackupRootPath, checkBackupPreconditions, upload, @@ -66,7 +66,7 @@ function getBucket(apiConfig) { } // storage api -function getRootPath(apiConfig) { +function getBackupRootPath(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); return apiConfig.prefix; diff --git a/src/storage/interface.js b/src/storage/interface.js index ebe1ce295..c78942587 100644 --- a/src/storage/interface.js +++ b/src/storage/interface.js @@ -11,7 +11,7 @@ // for the other API calls we leave it to the backend to retry. this allows // them to tune the concurrency based on failures/rate limits accordingly exports = module.exports = { - getRootPath, + getBackupRootPath, checkBackupPreconditions, upload, @@ -47,7 +47,7 @@ function injectPrivateFields(newConfig, currentConfig) { // in-place injection of tokens and api keys which came in with constants.SECRET_PLACEHOLDER } -function getRootPath(apiConfig) { +function getBackupRootPath(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); // Result: path at the backup storage diff --git a/src/storage/noop.js b/src/storage/noop.js index 425a3bf6e..c87a8ca69 100644 --- a/src/storage/noop.js +++ b/src/storage/noop.js @@ -1,7 +1,7 @@ 'use strict'; exports = module.exports = { - getRootPath, + getBackupRootPath, checkBackupPreconditions, upload, @@ -26,7 +26,7 @@ const assert = require('assert'), DataLayout = require('../datalayout.js'), debug = require('debug')('box:storage/noop'); -function getRootPath(apiConfig) { +function getBackupRootPath(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); return ''; } diff --git a/src/storage/s3.js b/src/storage/s3.js index 683143b5c..bee56e5f8 100644 --- a/src/storage/s3.js +++ b/src/storage/s3.js @@ -1,7 +1,7 @@ 'use strict'; exports = module.exports = { - getRootPath, + getBackupRootPath, checkBackupPreconditions, upload, @@ -92,7 +92,7 @@ function getS3Config(apiConfig) { } // storage api -function getRootPath(apiConfig) { +function getBackupRootPath(apiConfig) { assert.strictEqual(typeof apiConfig, 'object'); return apiConfig.prefix;