add storage api to make preflight checks

Currently there is only disk space checking but sshfs and cifs need
mount point checking as well
This commit is contained in:
Johannes Zellner
2020-06-08 16:25:00 +02:00
parent aa011f4add
commit 8624e2260d
7 changed files with 84 additions and 35 deletions
+10
View File
@@ -2,6 +2,7 @@
exports = module.exports = {
getBackupPath: getBackupPath,
checkPreconditions: checkPreconditions,
upload: upload,
download: download,
@@ -27,6 +28,7 @@ var assert = require('assert'),
BoxError = require('../boxerror.js'),
chunk = require('lodash.chunk'),
constants = require('../constants.js'),
DataLayout = require('../datalayout.js'),
debug = require('debug')('box:storage/s3'),
EventEmitter = require('events'),
https = require('https'),
@@ -91,6 +93,14 @@ function getBackupPath(apiConfig) {
return apiConfig.prefix;
}
function checkPreconditions(apiConfig, dataLayout, callback) {
assert.strictEqual(typeof apiConfig, 'object');
assert(dataLayout instanceof DataLayout, 'dataLayout must be a DataLayout');
assert.strictEqual(typeof callback, 'function');
callback(null);
}
function upload(apiConfig, backupFilePath, sourceStream, callback) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof backupFilePath, 'string');