Comparing version 0.1.0 to 0.1.1
@@ -25,7 +25,9 @@ "use strict"; | ||
priorityQ.push.apply(priorityQ, [msgs, priority]); | ||
const messagesTrace = messages.map((m) => Object.create(null, { | ||
boxName: { value: boxName }, | ||
messageId: { value: m.id }, | ||
parentMsgId: { value: m.parent && m.parent.id }, | ||
})); | ||
const messagesTrace = messages.map((m) => { | ||
return { | ||
boxName: boxName, | ||
messageId: m.id, | ||
parentMsgId: m.parent && m.parent.id, | ||
}; | ||
}); | ||
flowEmitter.emit('msg_finished', messagesTrace); | ||
@@ -32,0 +34,0 @@ } |
@@ -196,4 +196,5 @@ "use strict"; | ||
// Store the queues in metadata storage by boxes I am dependent of | ||
inputs.forEach((inEdge, index) => { | ||
for (let index = 0; index < inputs.length; index++) { | ||
// Edge == [from (i.e. me), parent] | ||
const inEdge = inputs[index]; | ||
const providingBox = inEdge[1]; | ||
@@ -203,3 +204,3 @@ const inputQ = inputQs[index]; | ||
graph.addEdge(boxName, providingBox, { queue: inputQ }); | ||
}); | ||
} | ||
return returnValue; | ||
@@ -206,0 +207,0 @@ }, Promise.resolve(Box_1.noopQueue)); |
@@ -19,2 +19,3 @@ "use strict"; | ||
const stats_1 = require("../../stats"); | ||
const every_1 = __importDefault(require("../../../bakeryjs/eval/every")); | ||
/** | ||
@@ -137,3 +138,3 @@ * Assume one has several queues already set up. We wan't a queue-like endpoint | ||
} | ||
if (state.flags.every((val) => val)) { | ||
if (every_1.default(state.flags, Boolean)) { | ||
this.output.push(msg, state.priority); | ||
@@ -140,0 +141,0 @@ delete this.msgJoinedState[msg.id]; |
@@ -25,3 +25,5 @@ "use strict"; | ||
if (Array.isArray(msgs)) { | ||
msgs.forEach((msg) => drainCallback(msg.export())); | ||
for (let i = 0; i < msgs.length; i++) { | ||
drainCallback(msgs[i].export()); | ||
} | ||
} | ||
@@ -28,0 +30,0 @@ else { |
@@ -26,3 +26,5 @@ "use strict"; | ||
if (Array.isArray(message)) { | ||
message.forEach((m) => this.queue.push({ m: m, p: priority })); | ||
for (let i = 0; i < message.length; i++) { | ||
this.queue.push({ m: message[i], p: priority }); | ||
} | ||
} | ||
@@ -29,0 +31,0 @@ else { |
@@ -207,3 +207,6 @@ /** | ||
private checkDimensionFinishState; | ||
private getSubDimensionsDone; | ||
private getDimensionDone; | ||
private getBoxesDone; | ||
} | ||
export {}; |
@@ -109,2 +109,3 @@ "use strict"; | ||
const builder_1 = require("./builders/DAGBuilder/builder"); | ||
const every_1 = require("./eval/every"); | ||
/** | ||
@@ -164,6 +165,3 @@ * Helper class. Throughout this code, the maps of maps are used extensively | ||
//The message is already tracked (e.g. from upstream box of the same dimension) | ||
this.msgStore | ||
.get(parentMsgId) | ||
.get(dimension) | ||
.has(msgId)) { | ||
this.msgStore.get(parentMsgId).get(dimension).has(msgId)) { | ||
// mark the box as passed | ||
@@ -231,3 +229,4 @@ this.msgStore | ||
this.msgStore.set(msgId, new DefinedMap()); | ||
subDimensions.forEach((subDim) => { | ||
for (let i = 0; i < subDimensions.length; i++) { | ||
const subDim = subDimensions[i]; | ||
mySubdims.set(subDim, { | ||
@@ -239,3 +238,3 @@ complete: false, | ||
this.msgStore.get(msgId).set(subDim, new DefinedMap()); | ||
}); | ||
} | ||
this.dimensionStore.set(msgId, mySubdims); | ||
@@ -246,7 +245,3 @@ } | ||
checkMsgFinishState(msgId, parentMsgId, dimension) { | ||
const boxesDone = Array.from(this.msgStore | ||
.get(parentMsgId) | ||
.get(dimension) | ||
.get(msgId) | ||
.boxes.values()).every((v) => v); | ||
const boxesDone = this.getBoxesDone(msgId, parentMsgId, dimension); | ||
if (!boxesDone) { | ||
@@ -257,5 +252,3 @@ return; | ||
// if the message has no subdimension, consider this check fulfilled | ||
const subDimensionsDone = this.dimensionStore.has(msgId) | ||
? Array.from(this.dimensionStore.get(msgId).values()).every((dt) => dt.complete && dt.done) | ||
: true; | ||
const subDimensionsDone = this.getSubDimensionsDone(msgId); | ||
if (!subDimensionsDone) { | ||
@@ -273,6 +266,3 @@ return; | ||
else { | ||
this.msgStore | ||
.get(parentMsgId) | ||
.get(dimension) | ||
.delete(msgId); | ||
this.msgStore.get(parentMsgId).get(dimension).delete(msgId); | ||
} | ||
@@ -284,6 +274,3 @@ // Delete all child dimensions (they are done, either) | ||
// delete the root job (it has no "parent" to handle it) | ||
this.msgStore | ||
.get(parentMsgId) | ||
.get(dimension) | ||
.delete(msgId); | ||
this.msgStore.get(parentMsgId).get(dimension).delete(msgId); | ||
// call the done callback | ||
@@ -303,7 +290,3 @@ this.jobDone(msgId); | ||
} | ||
const dimensionDone = this.dimensionStore.get(parentMsgId).get(dimension).complete && | ||
Array.from(this.msgStore | ||
.get(parentMsgId) | ||
.get(dimension) | ||
.values()).every((mT) => mT.done); | ||
const dimensionDone = this.getDimensionDone(parentMsgId, dimension); | ||
if (!dimensionDone) { | ||
@@ -325,3 +308,17 @@ return; | ||
} | ||
getSubDimensionsDone(msgId) { | ||
if (!this.dimensionStore.has(msgId)) | ||
return true; | ||
return every_1.everyMap(this.dimensionStore.get(msgId), (dt) => dt.complete && dt.done); | ||
} | ||
getDimensionDone(parentMsgId, dimension) { | ||
if (!this.dimensionStore.get(parentMsgId).get(dimension).complete) { | ||
return false; | ||
} | ||
return every_1.everyMap(this.msgStore.get(parentMsgId).get(dimension), (mT) => mT.done); | ||
} | ||
getBoxesDone(msgId, parentMsgId, dimension) { | ||
return every_1.everyMap(this.msgStore.get(parentMsgId).get(dimension).get(msgId).boxes, Boolean); | ||
} | ||
} | ||
exports.TracingModel = TracingModel; |
{ | ||
"name": "bakeryjs", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "FBP-inspired library", | ||
@@ -5,0 +5,0 @@ "main": "build/index", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
154962
67
3441
0