mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
StoreStorage (Durable's storage on Chord v2's store, @earendil-works/pi-durable/storage/store) passes Durable's storage conformance suite and runs Durable's harness tests (npm run test:store). The store gets owner names and claims, one id allocator, Durable's Storage semantics for refused steps, history none/latest/rewindable with reads at a point, archive revisions and applyBatch. self.follow follows Durable's synchronous observers as Chord sources. Persisted jobs: records and state in the owner's store, restarts as Durable's tasks, abort stored, deferred state. Chord's ./next export returns for the adapter surface.
23 lines
1.2 KiB
TypeScript
23 lines
1.2 KiB
TypeScript
// What `vitest.store.config.ts` puts in the place of `../src/storage/sqlite/node.ts`: the same exports, with
|
|
// `openNodeSqliteStorage(path)` opening Durable's storage on Chord's store over that file (`StoreStorage`), so the
|
|
// harness test files that take a SQLite storage run unchanged on the store.
|
|
|
|
import type { NodeSqliteDatabaseOptions } from "@earendil-works/chord/sqlite/node";
|
|
import type { SqliteStorageOptions } from "../src/storage/sqlite/index.ts";
|
|
import type { Storage } from "../src/types.ts";
|
|
import { openStoreStorage } from "./store-storage-support.ts";
|
|
|
|
export {
|
|
NodeSqliteDatabase,
|
|
type NodeSqliteDatabaseOptions,
|
|
openNodeSqliteDatabase,
|
|
} from "@earendil-works/chord/sqlite/node";
|
|
|
|
/** Node SQLite connection settings plus durable storage options, as the original takes them. */
|
|
export type NodeSqliteStorageOptions = NodeSqliteDatabaseOptions & SqliteStorageOptions;
|
|
|
|
/** A `StoreStorage` on a store over the file at `path`; a table prefix becomes nothing (the owner name separates). */
|
|
export function openNodeSqliteStorage(path: string, options: NodeSqliteStorageOptions = {}): Promise<Storage> {
|
|
const { prefix: _prefix, ...database } = options;
|
|
return openStoreStorage(path, database);
|
|
}
|