|
|
@ -951,7 +951,9 @@ var trimChannel = function (env, channelName, hash, _cb) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
module.exports.create = function (conf, cb) {
|
|
|
|
module.exports.create = function (conf, _cb) {
|
|
|
|
|
|
|
|
var cb = Util.once(Util.mkAsync(_cb));
|
|
|
|
|
|
|
|
|
|
|
|
var env = {
|
|
|
|
var env = {
|
|
|
|
root: conf.filePath || './datastore',
|
|
|
|
root: conf.filePath || './datastore',
|
|
|
|
archiveRoot: conf.archivePath || './data/archive',
|
|
|
|
archiveRoot: conf.archivePath || './data/archive',
|
|
|
@ -984,18 +986,19 @@ module.exports.create = function (conf, cb) {
|
|
|
|
// make sure the store's directory exists
|
|
|
|
// make sure the store's directory exists
|
|
|
|
Fse.mkdirp(env.root, PERMISSIVE, w(function (err) {
|
|
|
|
Fse.mkdirp(env.root, PERMISSIVE, w(function (err) {
|
|
|
|
if (err && err.code !== 'EEXIST') {
|
|
|
|
if (err && err.code !== 'EEXIST') {
|
|
|
|
throw err; // XXX
|
|
|
|
w.abort();
|
|
|
|
|
|
|
|
return void cb(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
// make sure the cold storage directory exists
|
|
|
|
// make sure the cold storage directory exists
|
|
|
|
Fse.mkdirp(env.archiveRoot, PERMISSIVE, w(function (err) {
|
|
|
|
Fse.mkdirp(env.archiveRoot, PERMISSIVE, w(function (err) {
|
|
|
|
if (err && err.code !== 'EEXIST') {
|
|
|
|
if (err && err.code !== 'EEXIST') {
|
|
|
|
throw err; // XXX
|
|
|
|
w.abort();
|
|
|
|
|
|
|
|
return void cb(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}).nThen(function () {
|
|
|
|
}).nThen(function () {
|
|
|
|
// XXX leave a place for an error
|
|
|
|
cb(void 0, {
|
|
|
|
cb({
|
|
|
|
|
|
|
|
// OLDER METHODS
|
|
|
|
// OLDER METHODS
|
|
|
|
// write a new message to a log
|
|
|
|
// write a new message to a log
|
|
|
|
message: function (channelName, content, cb) {
|
|
|
|
message: function (channelName, content, cb) {
|
|
|
|