diff --git a/src/storage/interface.js b/src/storage/interface.js index 4a0ddaf5a..a589b3371 100644 --- a/src/storage/interface.js +++ b/src/storage/interface.js @@ -7,17 +7,13 @@ // ------------------------------------------- exports = module.exports = { - backupBegin: backupBegin, - backupDirectory: backupDirectory, - backupFinalize: backupFinalize, - - getRestoreUrl: getRestoreUrl, - getAppRestoreConfig: getAppRestoreConfig, - getLocalFilePath: getLocalFilePath, - - copyObject: copyObject, + backup: backup, + restore: restore, + copyBackup: copyBackup, removeBackup: removeBackup, + getDownloadStream: getDownloadStream, + backupDone: backupDone, testConfig: testConfig @@ -25,9 +21,10 @@ exports = module.exports = { var assert = require('assert'); -function backupBegin(apiConfig, backupId, callback) { +function backup(apiConfig, backupId, sourceDirectories, callback) { assert.strictEqual(typeof apiConfig, 'object'); assert.strictEqual(typeof backupId, 'string'); + assert(Array.isArray(sourceDirectories)); assert.strictEqual(typeof callback, 'function'); // Result: none @@ -35,11 +32,10 @@ function backupBegin(apiConfig, backupId, callback) { callback(new Error('not implemented')); } -function backupDirectory(apiConfig, backupId, source, destination, callback) { +function restore(apiConfig, backupId, destinationDirectories, callback) { assert.strictEqual(typeof apiConfig, 'object'); assert.strictEqual(typeof backupId, 'string'); - assert.strictEqual(typeof source, 'string'); - assert.strictEqual(typeof destination, 'string'); + assert(Array.isArray(destinationDirectories)); assert.strictEqual(typeof callback, 'function'); // Result: none @@ -47,55 +43,10 @@ function backupDirectory(apiConfig, backupId, source, destination, callback) { callback(new Error('not implemented')); } -function backupFinalize(apiConfig, backupId, callback) { +function copyBackup(apiConfig, oldBackupId, newBackupId, callback) { assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof backupId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - // Result: none - - callback(new Error('not implemented')); -} - -function getRestoreUrl(apiConfig, filename, callback) { - assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof filename, 'string'); - assert.strictEqual(typeof callback, 'function'); - - // Result: { url: , sha1: } - // The resulting url must work with curl as it is passed into start.sh and restoreapp.sh - - callback(new Error('not implemented')); -} - -function getAppRestoreConfig(apiConfig, backupId, callback) { - assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof backupId, 'string'); - assert.strictEqual(typeof callback, 'function'); - - // var configFilename = backupId.replace(/\.tar\.gz$/, '.json'); - - // Result: {} <- Backup config object from .json file - // The resulting url must work with curl as it is passed into start.sh and restoreapp.sh - - callback(new Error('not implemented')); -} - -function getLocalFilePath(apiConfig, filename, callback) { - assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof filename, 'string'); - assert.strictEqual(typeof callback, 'function'); - - // Result: { filePath: } - // The resulting filePath is a local path to the backup file - - callback(new Error('not implemented')); -} - -function copyObject(apiConfig, from, to, callback) { - assert.strictEqual(typeof apiConfig, 'object'); - assert.strictEqual(typeof from, 'string'); - assert.strictEqual(typeof to, 'string'); + assert.strictEqual(typeof oldBackupId, 'string'); + assert.strictEqual(typeof newBackupId, 'string'); assert.strictEqual(typeof callback, 'function'); // Result: none @@ -114,11 +65,21 @@ function removeBackup(apiConfig, backupId, appBackupIds, callback) { callback(new Error('not implemented')); } +function getDownloadStream(apiConfig, backupId, callback) { + assert.strictEqual(typeof apiConfig, 'object'); + assert.strictEqual(typeof backupId, 'string'); + assert.strictEqual(typeof callback, 'function'); + + // Result: ReadStream to a tar.gz (not encrypted) + + callback(new Error('not implemented')); +} + function testConfig(apiConfig, callback) { assert.strictEqual(typeof apiConfig, 'object'); assert.strictEqual(typeof callback, 'function'); - // Result: none + // Result: none - first callback argument error if config does not pass the test callback(new Error('not implemented')); }