Dataspace.boot
This commit is contained in:
parent
6d7dbaf3b3
commit
e0d76f8dd3
|
@ -6,7 +6,7 @@ import {
|
|||
Pattern as P,
|
||||
assertObserve,
|
||||
Record,
|
||||
Actor, Dataspace, Turn,
|
||||
Dataspace, Turn,
|
||||
} from '..';
|
||||
|
||||
const BoxState = Record.makeConstructor()(Symbol.for('BoxState'), ['value']);
|
||||
|
@ -16,10 +16,7 @@ const N = 100000;
|
|||
|
||||
console.time('box-and-client-' + N.toString());
|
||||
|
||||
Actor.boot(() => {
|
||||
Turn.activeFacet.preventInertCheck();
|
||||
const ds = Turn.ref(new Dataspace());
|
||||
|
||||
Dataspace.boot(ds => {
|
||||
Turn.active.spawn(() => {
|
||||
Turn.activeFacet.actor.name = 'box';
|
||||
const boxValue = Turn.active.field(0, 'value');
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
Pattern as P,
|
||||
assertObserve,
|
||||
Record,
|
||||
Actor, Dataspace, Turn,
|
||||
Dataspace, Turn,
|
||||
} from '..';
|
||||
|
||||
const BoxState = Record.makeConstructor<{value: number}>()(Symbol.for('BoxState'), ['value']);
|
||||
|
@ -16,10 +16,7 @@ const N = 100000;
|
|||
|
||||
console.time('box-and-client-' + N.toString());
|
||||
|
||||
Actor.boot(() => {
|
||||
Turn.activeFacet.preventInertCheck();
|
||||
const ds = Turn.ref(new Dataspace());
|
||||
|
||||
Dataspace.boot(ds => {
|
||||
Turn.active.spawn(() => {
|
||||
Turn.activeFacet.actor.name = 'box';
|
||||
const boxValue = Turn.active.field<number>(0, 'value');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { IdentityMap, stringify } from '@preserves/core';
|
||||
import { Index } from './skeleton.js';
|
||||
import { Assertion, Entity, Facet, Handle, LocalAction, Ref, Turn } from './actor.js';
|
||||
import { Actor, Assertion, Entity, Facet, Handle, LocalAction, Ref, Turn } from './actor.js';
|
||||
import { fromObserve, Observe, toObserve } from '../gen/dataspace.js';
|
||||
import * as P from '../gen/dataspacePatterns.js';
|
||||
|
||||
|
@ -38,6 +38,14 @@ export class Dataspace implements Partial<Entity> {
|
|||
// console.log('!', stringify(v));
|
||||
this.index.deliverMessage(v);
|
||||
}
|
||||
|
||||
static boot(bootProc: (ds: Ref) => void): Actor {
|
||||
return Actor.boot(() => {
|
||||
Turn.activeFacet.preventInertCheck();
|
||||
const ds = Turn.active.ref(new Dataspace());
|
||||
bootProc(ds);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function assertionObserver(f: (a: Assertion) => LocalAction | undefined): Partial<Entity> {
|
||||
|
|
Loading…
Reference in New Issue