sync/src/channel-storage/channelstore.js

24 lines
565 B
JavaScript
Raw Normal View History

2015-09-21 06:17:06 +00:00
import { FileStore } from './filestore';
2015-09-26 21:21:42 +00:00
import { DatabaseStore } from './dbstore';
import Config from '../config';
2015-09-21 06:17:06 +00:00
const CHANNEL_STORE = loadChannelStore();
2015-09-21 06:17:06 +00:00
export function load(channelName) {
return CHANNEL_STORE.load(channelName);
}
export function save(channelName, data) {
return CHANNEL_STORE.save(channelName, data);
}
function loadChannelStore() {
switch (Config.get('channel-storage.type')) {
case 'database':
return new DatabaseStore();
case 'file':
default:
return new FileStore();
}
}