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

56 lines
2.2 KiB
TypeScript

//---------------------------------------------------------------------------
// @syndicate-lang/core, an implementation of Syndicate dataspaces for JS.
// Copyright (C) 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//---------------------------------------------------------------------------
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");
}
}