From 28dee5f098bf97f141d79bf2e5ac49ef6b2523de Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 16 Jun 2023 21:31:51 +0200 Subject: [PATCH] Store the whole assertion when crossSpace --- .../local-protocols/schemas/queuedTasks.prs | 4 +--- packages/core/src/runtime/actor.ts | 17 +++++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/core/local-protocols/schemas/queuedTasks.prs b/packages/core/local-protocols/schemas/queuedTasks.prs index 94744f7..a0d079c 100644 --- a/packages/core/local-protocols/schemas/queuedTasks.prs +++ b/packages/core/local-protocols/schemas/queuedTasks.prs @@ -5,12 +5,10 @@ ActionDescription = / @spawnActor / @stopActor / @inertCheck -/ +/ / / / . -CrossSpacePins = @none #f / @some [#!any ...] . - OptionalAny = / . diff --git a/packages/core/src/runtime/actor.ts b/packages/core/src/runtime/actor.ts index a245893..0e89056 100644 --- a/packages/core/src/runtime/actor.ts +++ b/packages/core/src/runtime/actor.ts @@ -84,7 +84,7 @@ export function assertionFrom(a: Assertable): Assertion { } } -type OutboundAssertion = { handle: Handle, peer: Ref, crossSpacePins: Ref[] | null, established: boolean }; +type OutboundAssertion = { handle: Handle, peer: Ref, crossSpace: Assertion | null, established: boolean }; type OutboundMap = Map; let nextActorId = 0; @@ -208,7 +208,7 @@ export class Facet { const e = { handle: h, peer: { relay: other, target: new StopOnRetract() }, - crossSpacePins: null, + crossSpace: null, established: true, }; this.outbound.set(h, e); @@ -455,8 +455,7 @@ export class Turn { const a = runRewrites(ref.attenuation, assertion); if (a !== null) { const crossSpace = this.activeFacet.actor.space !== ref.relay.actor.space; - const pins = crossSpace ? this.activeFacet.actor.space.extractPins(a) : null; - const e = { handle: h, peer: ref, crossSpacePins: pins, established: false }; + const e = { handle: h, peer: ref, crossSpace: crossSpace ? a : null, established: false }; this.activeFacet.outbound.set(h, e); this.enqueue(ref.relay, () => { @@ -468,11 +467,9 @@ export class Turn { }, () => Q.ActionDescription.assert({ target: ref, - crossSpacePins: (pins === null - ? Q.CrossSpacePins.none() - : Q.CrossSpacePins.some(pins)), + crossSpace, handle: h, - assertion, + assertion: a, })); } } @@ -499,13 +496,13 @@ export class Turn { () => { if (e.established) { e.established = false; - if (e.crossSpacePins) e.peer.relay.actor.space.deregisterInbound(e.handle); + if (e.crossSpace) e.peer.relay.actor.space.deregisterInbound(e.handle); e.peer.target.retract?.(e.handle); } }, () => Q.ActionDescription.retract({ target: e.peer, - crossSpace: e.crossSpacePins !== null, + crossSpace: e.crossSpace !== null, handle: e.handle, })); }