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