diff --git a/packages/swing-store/docs/swingstore.md b/packages/swing-store/docs/swingstore.md index b6cde0a45c1..a384120628c 100644 --- a/packages/swing-store/docs/swingstore.md +++ b/packages/swing-store/docs/swingstore.md @@ -25,8 +25,6 @@ If, for some reason, the host wants to abandon execution, it can call `hostStora `hostStorage.kvStore` is also available to let the host add items to a separate portion of the kvStore, using keys which start with a `host.` prefix. It can use this to coordinate with a separately-committed host database (e.g. to remember how much work has been given to the kernel, and how much has been successfully executed). This portion of the kvStore is unreachable by the kernel. -`hostStorage.setExportCallback()` is used to register an export callback after swingstore creation, see [data-export.md](./data-export.md) for details. Most applications will instead provide `options.exportCallback` to `openSwingStore()`. - `hostStorage.repairMetadata()` was used to repair a historical flaw in the database format, and is not needed by new installations. ## KernelStorage diff --git a/packages/swing-store/src/swingStore.js b/packages/swing-store/src/swingStore.js index a9551220f56..64d2d01de67 100644 --- a/packages/swing-store/src/swingStore.js +++ b/packages/swing-store/src/swingStore.js @@ -48,7 +48,6 @@ import { doRepairMetadata } from './repairMetadata.js'; * commit: () => Promise, // commit changes made since the last commit * close: () => Promise, // shutdown the store, abandoning any uncommitted changes * diskUsage?: () => number, // optional stats method - * setExportCallback: (cb: (updates: KVPair[]) => void) => void, // Set a callback invoked by swingStore when new serializable data is available for export * repairMetadata: (exporter: import('./exporter.js').SwingStoreExporter) => Promise, * }} SwingStoreHostStorage */ @@ -274,14 +273,10 @@ export function makeSwingStore(dirPath, forceReset, options = {}) { ) `); - let exportCallback; - function setExportCallback(cb) { - typeof cb === 'function' || Fail`callback must be a function`; - exportCallback = cb; - } - if (options.exportCallback) { - setExportCallback(options.exportCallback); - } + const { exportCallback } = options; + exportCallback === undefined || + typeof exportCallback === 'function' || + Fail`export callback must be a function`; const sqlAddPendingExport = db.prepare(` INSERT INTO pendingExports (key, value) @@ -600,7 +595,6 @@ export function makeSwingStore(dirPath, forceReset, options = {}) { commit, close, diskUsage, - setExportCallback, }; const debug = { serialize,