Changeset - b51c74da9d35
[Not reviewed]
default
0 3 0
drewp@bigasterisk.com - 20 months ago 2023-05-29 20:22:44
drewp@bigasterisk.com
more cleanup- mixed up with other commits
3 files changed with 10 insertions and 8 deletions:
0 comments (0 inline, 0 general)
light9/web/AutoDependencies.ts
Show inline comments
 
@@ -2,16 +2,11 @@ import debug from "debug";
 
import { NamedNode, Quad_Graph, Quad_Object, Quad_Predicate, Quad_Subject, Term, Util } from "n3";
 
import { filter } from "underscore";
 
import { Patch, QuadPattern } from "./patch";
 
import { SubEvent } from "sub-events";
 
import { SyncedGraph } from "./SyncedGraph";
 

	
 
const log = debug("autodep");
 

	
 
interface QuadPattern {
 
  subject: Quad_Subject | null;
 
  predicate: Quad_Predicate | null;
 
  object: Quad_Object | null;
 
  graph: Quad_Graph | null;
 
}
 

	
 
// use patch as an optional optimization, but you can't count on it
 
export type HandlerFunc = (p?: Patch) => void;
 

	
 
@@ -28,7 +23,8 @@ class Handler {
 
export class AutoDependencies {
 
  handlers: Handler;
 
  handlerStack: Handler[];
 
  constructor() {
 
  graphError: SubEvent<string> = new SubEvent();
 
  constructor(private graph: SyncedGraph) {
 
    // tree of all known Handlers (at least those with non-empty
 
    // patterns). Top node is not a handler.
 
    this.handlers = new Handler(null, "root");
 
@@ -75,6 +71,7 @@ export class AutoDependencies {
 
      this.handlerStack.pop();
 
    }
 
  }
 

	
 
  // handler might have no watches, in which case we could forget about it
 
  logHandlerTree() {
 
    log("handler tree:");
light9/web/RdfdbSyncedGraph.ts
Show inline comments
 
@@ -33,6 +33,7 @@ export class RdfdbSyncedGraph extends Li
 
    const prefixes = new Map<string, string>([
 
      ["", "http://light9.bigasterisk.com/"],
 
      ["dev", "http://light9.bigasterisk.com/device/"],
 
      ["effect", "http://light9.bigasterisk.com/effect/"],
 
      ["rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"],
 
      ["rdfs", "http://www.w3.org/2000/01/rdf-schema#"],
 
      ["xsd", "http://www.w3.org/2001/XMLSchema#"],
light9/web/SyncedGraph.ts
Show inline comments
 
@@ -36,6 +36,10 @@ export class SyncedGraph {
 
    this.prefixFuncs = this.rebuildPrefixFuncs(prefixes);
 
    this.graph = new N3.Store();
 
    this.autoDeps = new AutoDependencies(this);
 
    this.autoDeps.graphError.subscribe((e) => {
 
      log("graph learned of error - reconnecting", e);
 
      this.client.disconnect();
 
    });
 
    this.clearGraph();
 

	
 
    this.client = new RdfDbClient(patchSenderUrl, this._clearGraphOnNewConnection.bind(this), this._applyPatch.bind(this), this.setStatus);
0 comments (0 inline, 0 general)