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:
@@ -12,6 +12,7 @@
|
||||
// them to tune the concurrency based on failures/rate limits accordingly
|
||||
exports = module.exports = {
|
||||
getBackupPath: getBackupPath,
|
||||
checkPreconditions: checkPreconditions,
|
||||
|
||||
upload: upload,
|
||||
|
||||
@@ -31,6 +32,7 @@ exports = module.exports = {
|
||||
|
||||
var assert = require('assert'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
DataLayout = require('../datalayout.js'),
|
||||
EventEmitter = require('events');
|
||||
|
||||
function removePrivateFields(apiConfig) {
|
||||
@@ -50,6 +52,14 @@ function getBackupPath(apiConfig) {
|
||||
return '/';
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user