checkpoint prototype

This commit is contained in:
Stewart Allen 2023-01-09 14:55:17 -05:00
commit 849a55439b
12 changed files with 169 additions and 50 deletions

View file

@ -18,6 +18,7 @@ let loc = self.location,
syncd = {},
running = {},
worker = null,
minions = false,
restarting = false
// occ = new Worker("/kiri/ext/occ-worker.js", {type:"module"}),
;
@ -56,10 +57,12 @@ const client = exports({
pool: {
start() {
minions = true;
send("pool_start", {}, noop);
},
stop() {
minions = false;
send("pool_stop", {}, noop);
}
},
@ -126,6 +129,11 @@ const client = exports({
}
};
// restart minions if they were running
if (minions) {
client.pool.start();
}
restarting = false;
},
@ -166,7 +174,7 @@ const client = exports({
widgets.forEach(widget => {
if (widget.modified || !syncd[widget.id]) {
syncd[widget.id] = true;
let vertices = widget.getGeoVertices().buffer.slice(0);
let vertices = widget.getGeoVertices();
send("sync", {
id: widget.id,
meta: widget.meta,
@ -176,7 +184,7 @@ const client = exports({
position: widget.mesh.position,
}, done => {
widget.modified = false;
}, [vertices]);
});
}
});
},
@ -303,6 +311,19 @@ const client = exports({
send("wasm", {enable}, reply => {
// console.log({wasm_worker_said: reply});
});
},
putCache(key, data) {
console.log({ putCache: key, data });
send("putCache", {key, data}, reply => {
// console.log({ putCache_reply: reply });
});
},
clearCache() {
send("clearCache", {}, reply => {
// console.log({ clearCache_reply: reply });
});
}
});