Repairs after merge

This commit is contained in:
Tony Garnock-Jones 2024-04-15 10:12:30 +02:00
parent 6d82440704
commit 7b9f0a6b16
3 changed files with 19 additions and 23 deletions

View File

@ -1,10 +1,10 @@
version 1 .
Reflect = <reflect @thing #!any> .
Reflect = <reflect @thing #:any> .
Type = <type @thing #!any @type TypeName> .
Facet = <facet @thing #!any @facet #!any> .
Attribute = <attribute @thing #!any @attribute any> .
Type = <type @thing #:any @type TypeName> .
Facet = <facet @thing #:any @facet #:any> .
Attribute = <attribute @thing #:any @attribute any> .
TypeName =
/ =entity
@ -18,19 +18,19 @@ TypeName =
EntityClass = <entity-class @value any> .
# Facet
FacetActor = <actor @actor #!any> .
FacetActor = <actor @actor #:any> .
FacetAlive = <alive @alive bool> .
FacetChild = <child @child #!any> .
FacetParent = =root / <parent @parent #!any> .
FacetAssertion = <assertion @handle int @target #!any>.
FacetChild = <child @child #:any> .
FacetParent = =root / <parent @parent #:any> .
FacetAssertion = <assertion @handle int @target #:any>.
FacetInertPreventers = <inert-preventers @inertPreventers int> .
# Actor
ActorName = <name @name any> .
ActorRoot = <root @root #!any> .
ActorRoot = <root @root #:any> .
ActorStatus = =running / =done / <crashed @reason string> .
# Space
SpaceTaskCount = <task-count @taskCount int> .
SpaceActor = <actor @actor #!any> .
SpaceActor = <actor @actor #:any> .
SpaceStatus = =running / =paused / =terminated .

View File

@ -99,7 +99,7 @@ export class Dataspace implements Partial<Entity> {
delete this._reflection;
} else {
this._reflection = { mirror, assertionHandles: {} };
mirror.constProp(Refl.EntityClass(Symbol.for('dataspace')));
mirror.constProp(Refl.EntityClass<Ref>(Symbol.for('dataspace')));
this.handleMap.forEach((v, handle) =>
this._reflection?.mirror.setProp(
this._reflection.assertionHandles,

View File

@ -1,15 +1,15 @@
/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2023 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
/// SPDX-FileCopyrightText: Copyright © 2023-2024 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { Actor, Ref, RefImpl, Facet, LocalAction, Turn, assertionFrom } from './actor';
import { Actor, Ref, Facet, LocalAction, Turn, assertionFrom } from './actor';
import type { Handle, Assertable } from './actor';
import type { Field } from './dataflow';
import * as Refl from '../gen/mirror';
import { Observe } from '../gen/dataspace';
import * as P from '../gen/dataspacePatterns';
import * as P from './pattern';
import { ActorSpace } from './space';
import { assertionFacetObserver, Dataspace } from './dataspace';
import { stringify, isEmbedded } from '@preserves/core';
import { stringify, isEmbedded, KeyedDictionary } from '@preserves/core';
export interface Reflectable {
asRef(): Ref;
@ -93,15 +93,11 @@ export function spawnMirror(sourceSpace: ActorSpace, targetSpace = new ActorSpac
tracer: (event, a, _ds, sig) => console.log('DS', event, stringify(a), sig),
}));
t.assert(image, Observe({
pattern: P.Pattern.DCompound(P.DCompound.rec({
label: Symbol.for('reflect'),
fields: [P.Pattern.DBind(P.DBind(P.Pattern.DDiscard(P.DDiscard())))],
})),
pattern: P.rec(Symbol.for('reflect'), P.bind()),
observer: t.ref(assertionFacetObserver(a => {
if (!Array.isArray(a)) return;
const [thing_embedded] = a;
if (!isEmbedded(thing_embedded)) return;
const thing = thing_embedded.embeddedValue;
const [thing] = a;
if (!isEmbedded(thing)) return;
new Mirror(thing, image, sourceSpace, Turn.active);
})),
}));
@ -114,7 +110,7 @@ export function _asRef(
facet: Facet,
): Ref {
if (x._reflectableRef === void 0) {
x._reflectableRef = new RefImpl(facet, { data: x, setMirror: m => x.setMirror(m) });
x._reflectableRef = new Ref(facet, { data: x, setMirror: m => x.setMirror(m) });
}
return x._reflectableRef;
}