Unverified Commit 6388055f authored by John McLear's avatar John McLear Committed by GitHub
Browse files

Merge pull request #12 from nashe/no_findkeys_export

No findkeys during export
parents bb40aa00 806c9207
...@@ -22,25 +22,18 @@ var ERR = require("async-stacktrace"); ...@@ -22,25 +22,18 @@ var ERR = require("async-stacktrace");
exports.getPadRaw = function(padId, callback){ exports.getPadRaw = function(padId, callback){
async.waterfall([ async.waterfall([
function(cb){ function(cb){
db.get("pad:"+padId, cb);
// Get the Pad
db.findKeys("pad:"+padId, null, function(err,padcontent){
if(!err){
cb(err, padcontent);
}
})
}, },
function(padcontent,cb){ function(padcontent,cb){
var records = ["pad:"+padId];
for (var i = 0; i <= padcontent.head; i++) {
records.push("pad:"+padId+":revs:" + i);
}
for (var i = 0; i <= padcontent.chatHead; i++) {
records.push("pad:"+padId+":chat:" + i);
}
// Get the Pad available content keys
db.findKeys("pad:"+padId+":*", null, function(err,records){
if(!err){
for (var key in padcontent) { records.push(padcontent[key]);}
cb(err, records);
}
})
},
function(records, cb){
var data = {}; var data = {};
async.forEachSeries(Object.keys(records), function(key, r){ async.forEachSeries(Object.keys(records), function(key, r){
...@@ -69,7 +62,7 @@ exports.getPadRaw = function(padId, callback){ ...@@ -69,7 +62,7 @@ exports.getPadRaw = function(padId, callback){
} }
r(null); // callback; r(null); // callback;
}); });
}, function(err){ }, function(err){
cb(err, data); cb(err, data);
}) })
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment