Spaces:
Running
Running
File size: 1,047 Bytes
3365e13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // core/backend.js — the durable byte backend for the κ-object store: IndexedDB via the OS
// runtime's _shared/holo-store.js (Law L3: the store is the memory; RAM is a bounded cache).
// Keys are κ hex strings (plus the one well-known boot-index pointer key). Same async shape
// as the witness's Map backend, so the L5 contract exercises identical code in both runtimes.
import { idbBackend } from "../_shared/holo-store.js";
export function kappaBackend() {
const idb = idbBackend({ db: "holo-q", store: "kappa" });
return {
get: async (hex) => (await idb.get(hex)) || undefined,
put: (hex, bytes) => idb.set(hex, bytes),
getRaw: async (k) => (await idb.get(k)) || undefined,
putRaw: (k, bytes) => idb.set(k, bytes),
has: (k) => idb.has(k),
};
}
// Storage usage for the Settings → Data tab (W3C StorageManager).
export async function storageEstimate() {
try { const e = await navigator.storage.estimate(); return { usage: e.usage || 0, quota: e.quota || 0 }; }
catch { return { usage: 0, quota: 0 }; }
}
|