MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / makeState

Function makeState

host/storage/src/main/state.js:3–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1/* Shared handle tables. One `makeState()` per `createWorker` so multiple workers don't share open IndexedDB connections. */
2
3export const makeState = () => {
4 const dbs = [];
5
6 const allocDb = (idb) => { dbs.push(idb); return dbs.length - 1; };
7 const db = (h) => {
8 if (h < 0 || h >= dbs.length || dbs[h] === null) {
9 throw new Error('invalid db handle: ' + h);
10 }
11 return dbs[h];
12 };
13
14 return { dbs, allocDb, db };
15};

Callers 1

storageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected