(
run: (
store: Store,
dbPath: string,
setFailpoint: (point: SqliteRuntimeStoreFailpoint | undefined) => void,
) => Promise<void>,
)
| 1751 | type Store = ReturnType<typeof createSqliteRuntimeStore>; |
| 1752 | |
| 1753 | async function withStore( |
| 1754 | run: ( |
| 1755 | store: Store, |
| 1756 | dbPath: string, |
| 1757 | setFailpoint: (point: SqliteRuntimeStoreFailpoint | undefined) => void, |
| 1758 | ) => Promise<void>, |
| 1759 | ): Promise<void> { |
| 1760 | const root = await mkdtemp(join(tmpdir(), 'maka-sqlite-runtime-')); |
| 1761 | const dbPath = join(root, 'runtime.sqlite'); |
| 1762 | let failpoint: SqliteRuntimeStoreFailpoint | undefined; |
| 1763 | const store = createSqliteRuntimeStore(dbPath, { |
| 1764 | failpoint: (point) => { |
| 1765 | if (failpoint === point) throw new Error(`sqlite runtime failpoint: ${point}`); |
| 1766 | }, |
| 1767 | }); |
| 1768 | try { |
| 1769 | await run(store, dbPath, (point) => { |
| 1770 | failpoint = point; |
| 1771 | }); |
| 1772 | } finally { |
| 1773 | store.close(); |
| 1774 | await rm(root, { recursive: true, force: true }); |
| 1775 | } |
| 1776 | } |
| 1777 | |
| 1778 | function continuationClaim( |
| 1779 | input: Parameters<typeof continuationClaimForBoundary>[1] = {}, |
no test coverage detected