From 6ae6e4eb829369d6883f115f94fd73e908447ccc Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sat, 3 Nov 2018 22:17:42 +0000 Subject: [PATCH] Track set of actors within a dataspace, for reflection/debugging. --- packages/core/src/dataspace.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/dataspace.js b/packages/core/src/dataspace.js index cbff83b..bca3bfd 100644 --- a/packages/core/src/dataspace.js +++ b/packages/core/src/dataspace.js @@ -47,6 +47,7 @@ function Dataspace(container, bootProc) { this.pendingActions = Immutable.List([ new ActionGroup(null, Immutable.List([new Spawn(null, bootProc, Immutable.Set())]))]); this.activatedModules = Immutable.Set(); + this.actors = Immutable.Set(); } // Parameters @@ -236,6 +237,7 @@ function Actor(dataspace, name, initialAssertions) { this.pendingActions = Immutable.List(); this.adhocAssertions = new Bag.MutableBag(initialAssertions); // no negative counts allowed this.cleanupChanges = new Bag.MutableBag(); // negative counts allowed! + dataspace.actors = dataspace.actors.add(this); } Actor.prototype.runPendingScripts = function () { @@ -391,6 +393,7 @@ function Quit() { // TODO: rename? Perhaps to Cleanup? Quit.prototype.perform = function (ds, ac) { ds.applyPatch(ac, ac.cleanupChanges.snapshot()); + ds.actors = ds.actors.remove(ac); }; function DeferredTurn(continuation) {