From fc7576fe205066e1755ce6a09a71e8a7a0194bc4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 15 Sep 2016 10:07:31 +0200 Subject: [PATCH] implement channel removal --- storage/file.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/storage/file.js b/storage/file.js index 6663ae2d8..b25a5c99f 100644 --- a/storage/file.js +++ b/storage/file.js @@ -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) { var env = { root: conf.filePath || './datastore', @@ -181,8 +186,9 @@ module.exports.create = function (conf, cb) { getMessages(env, channelName, msgHandler, cb); }, removeChannel: function (channelName, cb) { - console.log("[storage/file.removeChannel()] Not implemented"); - cb(); + removeChannel(env, channelName, function (err) { + cb(err); + }); }, }); });