add names for batched reads for debugging

This commit is contained in:
ansuz 2019-09-06 14:58:00 +02:00
parent a7e40040a1
commit 340a290ceb
2 changed files with 7 additions and 7 deletions

View File

@ -232,7 +232,7 @@ module.exports.create = function (cfg) {
as an added bonus:
if the channel exists but its index does not then it caches the index
*/
const batchIndexReads = BatchRead();
const batchIndexReads = BatchRead("HK_GET_INDEX");
const getIndex = (ctx, channelName, cb) => {
const chan = ctx.channels[channelName];
// if there is a channel in memory and it has an index cached, return it

12
rpc.js
View File

@ -232,7 +232,7 @@ var checkSignature = function (signedMsg, signature, publicKey) {
return Nacl.sign.detached.verify(signedBuffer, signatureBuffer, pubBuffer);
};
const batchUserPins = BatchRead();
const batchUserPins = BatchRead("LOAD_USER_PINS");
var loadUserPins = function (Env, publicKey, cb) {
var session = getSession(Env.Sessions, publicKey);
@ -294,7 +294,7 @@ var getUploadSize = function (Env, channel, cb) { // FIXME FILES
});
};
const batchFileSize = BatchRead();
const batchFileSize = BatchRead("GET_FILE_SIZE");
var getFileSize = function (Env, channel, cb) {
if (!isValidId(channel)) { return void cb('INVALID_CHAN'); }
batchFileSize(channel, cb, function (done) {
@ -320,7 +320,7 @@ var getFileSize = function (Env, channel, cb) {
});
};
const batchMetadata = BatchRead();
const batchMetadata = BatchRead("GET_METADATA");
var getMetadata = function (Env, channel, cb) {
if (!isValidId(channel)) { return void cb('INVALID_CHAN'); }
@ -478,7 +478,7 @@ var getDeletedPads = function (Env, channels, cb) {
});
};
const batchTotalSize = BatchRead();
const batchTotalSize = BatchRead("GET_TOTAL_SIZE");
var getTotalSize = function (Env, publicKey, cb) {
batchTotalSize(publicKey, cb, function (done) {
var bytes = 0;
@ -1614,7 +1614,7 @@ var writePrivateMessage = function (Env, args, nfwssCtx, cb) {
});
};
const batchDiskUsage = BatchRead();
const batchDiskUsage = BatchRead("GET_DISK_USAGE");
var getDiskUsage = function (Env, cb) {
batchDiskUsage('', cb, function (done) {
var data = {};
@ -1643,7 +1643,7 @@ var getDiskUsage = function (Env, cb) {
});
};
const batchRegisteredUsers = BatchRead();
const batchRegisteredUsers = BatchRead("GET_REGISTERED_USERS");
var getRegisteredUsers = function (Env, cb) {
batchRegisteredUsers('', cb, function (done) {
var dir = Env.paths.pin;