syndicate-js/packages/core/src/runtime/dataspace.ts

41 lines
1.4 KiB
TypeScript

/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { Value, is, Set } from '@preserves/core';
import * as Skeleton from './skeleton.js';
import { Bag, ChangeDescription } from './bag.js';
import * as Dataflow from './dataflow.js';
import { IdentitySet, IdentityMap } from './idcoll.js';
export class Dataspace implements Partial<Entity> {
index = new Skeleton.Index();
// adjustIndex(a: Value<any>, count: number) {
// return this.index.adjustAssertion(a, count);
// }
// subscribe(handler: Skeleton.Analysis) {
// this.index.addHandler(handler, handler.callback!);
// }
// unsubscribe(handler: Skeleton.Analysis) {
// this.index.removeHandler(handler, handler.callback!);
// }
assert(turn: Turn, rec: Assertion, handle: Handle): void {
console.log(preserves`ds ${turn.activeFacet.id} assert ${rec} ${handle}`);
throw new Error("Full dataspaces not implemented");
}
retract(turn: Turn, upstreamHandle: Handle): void {
console.log(preserves`ds ${turn.activeFacet.id} retract ${upstreamHandle}`);
throw new Error("Full dataspaces not implemented");
}
message(turn: Turn, rec: Assertion): void {
console.log(preserves`ds ${turn.activeFacet.id} message ${rec}`);
throw new Error("Full dataspaces not implemented");
}
}