2017-11-24 01:10:55 +02:00
|
|
|
const BaseSyncTarget = require('lib/BaseSyncTarget.js');
|
2017-12-14 20:12:14 +02:00
|
|
|
const Setting = require('lib/models/Setting.js');
|
2017-11-24 20:37:40 +02:00
|
|
|
const { FileApi } = require('lib/file-api.js');
|
|
|
|
const { FileApiDriverMemory } = require('lib/file-api-driver-memory.js');
|
|
|
|
const { Synchronizer } = require('lib/synchronizer.js');
|
2017-11-24 01:10:55 +02:00
|
|
|
|
2017-11-24 21:09:15 +02:00
|
|
|
class SyncTargetMemory extends BaseSyncTarget {
|
2017-11-24 20:59:16 +02:00
|
|
|
static id() {
|
2017-11-24 01:10:55 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-11-24 21:21:30 +02:00
|
|
|
static targetName() {
|
|
|
|
return 'memory';
|
|
|
|
}
|
|
|
|
|
2017-11-24 20:59:16 +02:00
|
|
|
static label() {
|
2017-11-24 01:10:55 +02:00
|
|
|
return 'Memory';
|
|
|
|
}
|
|
|
|
|
2018-03-26 19:33:55 +02:00
|
|
|
async isAuthenticated() {
|
2017-11-24 01:10:55 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-11-24 20:37:40 +02:00
|
|
|
initFileApi() {
|
|
|
|
const fileApi = new FileApi('/root', new FileApiDriverMemory());
|
|
|
|
fileApi.setLogger(this.logger());
|
2017-11-24 21:09:15 +02:00
|
|
|
fileApi.setSyncTargetId(SyncTargetMemory.id());
|
2017-11-24 20:37:40 +02:00
|
|
|
return fileApi;
|
|
|
|
}
|
|
|
|
|
|
|
|
async initSynchronizer() {
|
2017-11-24 20:59:16 +02:00
|
|
|
return new Synchronizer(this.db(), await this.fileApi(), Setting.value('appType'));
|
2017-11-24 20:37:40 +02:00
|
|
|
}
|
2017-11-24 01:10:55 +02:00
|
|
|
}
|
|
|
|
|
2019-07-29 15:43:53 +02:00
|
|
|
module.exports = SyncTargetMemory;
|