move some implictly global state to env.js

pull/1/head
ansuz 4 years ago
parent 12c4451f53
commit 1f1b40b83d

@ -2,7 +2,6 @@
const Data = module.exports; const Data = module.exports;
const Meta = require("../metadata"); const Meta = require("../metadata");
const WriteQueue = require("../write-queue");
const Core = require("./core"); const Core = require("./core");
const Util = require("../common-util"); const Util = require("../common-util");
const HK = require("../hk-util"); const HK = require("../hk-util");
@ -53,7 +52,6 @@ Data.getMetadata = function (Env, channel, cb, Server, netfluxId) {
value: value value: value
} }
*/ */
var queueMetadata = WriteQueue();
Data.setMetadata = function (Env, safeKey, data, cb, Server) { Data.setMetadata = function (Env, safeKey, data, cb, Server) {
var unsafeKey = Util.unescapeKeyCharacters(safeKey); var unsafeKey = Util.unescapeKeyCharacters(safeKey);
@ -63,7 +61,7 @@ Data.setMetadata = function (Env, safeKey, data, cb, Server) {
if (!command || typeof (command) !== 'string') { return void cb('INVALID_COMMAND'); } if (!command || typeof (command) !== 'string') { return void cb('INVALID_COMMAND'); }
if (Meta.commands.indexOf(command) === -1) { return void cb('UNSUPPORTED_COMMAND'); } if (Meta.commands.indexOf(command) === -1) { return void cb('UNSUPPORTED_COMMAND'); }
queueMetadata(channel, function (next) { Env.queueMetadata(channel, function (next) {
Data.getMetadataRaw(Env, channel, function (err, metadata) { Data.getMetadataRaw(Env, channel, function (err, metadata) {
if (err) { if (err) {
cb(err); cb(err);

@ -45,6 +45,7 @@ module.exports.create = function (config) {
queueStorage: WriteQueue(), queueStorage: WriteQueue(),
queueDeletes: WriteQueue(), queueDeletes: WriteQueue(),
queueValidation: WriteQueue(), queueValidation: WriteQueue(),
queueMetadata: WriteQueue(),
batchIndexReads: BatchRead("HK_GET_INDEX"), batchIndexReads: BatchRead("HK_GET_INDEX"),
batchMetadata: BatchRead('GET_METADATA'), batchMetadata: BatchRead('GET_METADATA'),

Loading…
Cancel
Save