implement channel removal

pull/1/head
ansuz 8 years ago
parent 0296989515
commit fc7576fe20

@ -162,6 +162,11 @@ var getMessages = function (env, chanName, handler, cb) {
}); });
}; };
var removeChannel = function (env, channelName, cb) {
var filename = Path.join(env.root, channelName.slice(0, 2), channelName + '.ndjson');
Fs.unlink(filename, cb);
};
module.exports.create = function (conf, cb) { module.exports.create = function (conf, cb) {
var env = { var env = {
root: conf.filePath || './datastore', root: conf.filePath || './datastore',
@ -181,8 +186,9 @@ module.exports.create = function (conf, cb) {
getMessages(env, channelName, msgHandler, cb); getMessages(env, channelName, msgHandler, cb);
}, },
removeChannel: function (channelName, cb) { removeChannel: function (channelName, cb) {
console.log("[storage/file.removeChannel()] Not implemented"); removeChannel(env, channelName, function (err) {
cb(); cb(err);
});
}, },
}); });
}); });

Loading…
Cancel
Save