2016-09-16 12:55:45 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
// This file just describes the interface
|
|
|
|
|
//
|
|
|
|
|
// New backends can start from here
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
|
|
|
|
|
exports = module.exports = {
|
2017-04-18 14:55:22 +02:00
|
|
|
backup: backup,
|
|
|
|
|
restore: restore,
|
|
|
|
|
copyBackup: copyBackup,
|
2017-04-23 11:34:46 -07:00
|
|
|
removeBackups: removeBackups,
|
2016-10-11 11:36:25 +02:00
|
|
|
|
2017-01-04 16:22:58 -08:00
|
|
|
backupDone: backupDone,
|
|
|
|
|
|
2016-10-11 11:36:25 +02:00
|
|
|
testConfig: testConfig
|
2016-09-16 12:55:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
2017-09-13 09:22:50 -07:00
|
|
|
function backup(apiConfig, backupId, sourceDir, callback) {
|
2016-09-16 12:55:45 +02:00
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
2017-04-11 11:00:55 +02:00
|
|
|
assert.strictEqual(typeof backupId, 'string');
|
2017-09-13 09:22:50 -07:00
|
|
|
assert.strictEqual(typeof sourceDir, 'string');
|
2016-09-16 12:55:45 +02:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
2017-04-11 11:00:55 +02:00
|
|
|
// Result: none
|
2016-09-16 12:55:45 +02:00
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-20 16:41:19 +02:00
|
|
|
function restore(apiConfig, backupId, destination, callback) {
|
2016-09-16 12:55:45 +02:00
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
2017-04-11 11:00:55 +02:00
|
|
|
assert.strictEqual(typeof backupId, 'string');
|
2017-04-20 16:41:19 +02:00
|
|
|
assert.strictEqual(typeof destination, 'string');
|
2016-09-16 12:55:45 +02:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
2017-04-11 11:00:55 +02:00
|
|
|
// Result: none
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-18 14:55:22 +02:00
|
|
|
function copyBackup(apiConfig, oldBackupId, newBackupId, callback) {
|
2017-04-11 11:00:55 +02:00
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
2017-04-18 14:55:22 +02:00
|
|
|
assert.strictEqual(typeof oldBackupId, 'string');
|
|
|
|
|
assert.strictEqual(typeof newBackupId, 'string');
|
2017-04-11 11:00:55 +02:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: none
|
2016-09-16 12:55:45 +02:00
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-23 11:34:46 -07:00
|
|
|
function removeBackups(apiConfig, backupIds, callback) {
|
2016-09-19 15:03:38 +02:00
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
2017-04-23 11:34:46 -07:00
|
|
|
assert(Array.isArray(backupIds));
|
2016-09-16 12:55:45 +02:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
// Result: none
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
2016-10-10 15:04:28 +02:00
|
|
|
|
2016-10-11 11:36:25 +02:00
|
|
|
function testConfig(apiConfig, callback) {
|
|
|
|
|
assert.strictEqual(typeof apiConfig, 'object');
|
|
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
2017-04-18 14:55:22 +02:00
|
|
|
// Result: none - first callback argument error if config does not pass the test
|
2016-10-11 11:36:25 +02:00
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|
2017-01-04 16:22:58 -08:00
|
|
|
|
2017-04-21 10:31:43 +02:00
|
|
|
function backupDone(backupId, appBackupIds, callback) {
|
|
|
|
|
assert.strictEqual(typeof backupId, 'string');
|
|
|
|
|
assert(Array.isArray(appBackupIds));
|
2017-01-04 16:22:58 -08:00
|
|
|
assert.strictEqual(typeof callback, 'function');
|
|
|
|
|
|
|
|
|
|
callback(new Error('not implemented'));
|
|
|
|
|
}
|