|
|
|
@ -51,7 +51,7 @@ var mkPath = function (env, channelId) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var mkArchivePath = function (env, channelId) {
|
|
|
|
|
return Path.join(env.archiveRoot, 'datastore', channelId.slice(0, 2), channelId) + '.ndjson';
|
|
|
|
|
return Path.join(env.archiveRoot, env.volumeId, channelId.slice(0, 2), channelId) + '.ndjson';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var mkMetadataPath = function (env, channelId) {
|
|
|
|
@ -59,7 +59,7 @@ var mkMetadataPath = function (env, channelId) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var mkArchiveMetadataPath = function (env, channelId) {
|
|
|
|
|
return Path.join(env.archiveRoot, 'datastore', channelId.slice(0, 2), channelId) + '.metadata.ndjson';
|
|
|
|
|
return Path.join(env.archiveRoot, env.volumeId, channelId.slice(0, 2), channelId) + '.metadata.ndjson';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var mkTempPath = function (env, channelId) {
|
|
|
|
@ -1044,6 +1044,9 @@ module.exports.create = function (conf, _cb) {
|
|
|
|
|
var env = {
|
|
|
|
|
root: conf.filePath || './datastore',
|
|
|
|
|
archiveRoot: conf.archivePath || './data/archive',
|
|
|
|
|
// supply a volumeId if you want a store to archive channels to and from
|
|
|
|
|
// to its own subpath within the archive directory
|
|
|
|
|
volumeId: conf.volumeId || 'datastore',
|
|
|
|
|
channels: { },
|
|
|
|
|
batchGetChannel: BatchRead('store_batch_channel'),
|
|
|
|
|
};
|
|
|
|
@ -1076,7 +1079,7 @@ module.exports.create = function (conf, _cb) {
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
// make sure the cold storage directory exists
|
|
|
|
|
Fse.mkdirp(env.archiveRoot, PERMISSIVE, w(function (err) {
|
|
|
|
|
Fse.mkdirp(Path.join(env.archiveRoot, env.volumeId), PERMISSIVE, w(function (err) {
|
|
|
|
|
if (err && err.code !== 'EEXIST') {
|
|
|
|
|
w.abort();
|
|
|
|
|
return void cb(err);
|
|
|
|
|