space-data-module-sdk 0.8.21 → 0.8.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/isomorphic-pthreads.html +88 -0
- package/docs/isomorphic-pthreads.md +290 -0
- package/package.json +7 -2
- package/src/browser.js +6 -0
- package/src/flow/flatsqlLinkShim.js +295 -0
- package/src/flow/index.d.ts +31 -0
- package/src/flow/index.js +8 -0
- package/src/host/browserCapabilityProbe.js +251 -0
- package/src/host/flatsqlIo.js +14 -0
- package/src/host/flatsqlIoConformance.js +349 -0
- package/src/host/flatsqlIoContract.js +240 -0
- package/src/host/flatsqlIoImports.js +335 -0
- package/src/host/flatsqlIoMemoryBackend.js +178 -0
- package/src/host/flatsqlIoServer.js +960 -0
- package/src/host/flatsqlIoWorkers.js +323 -0
- package/src/host/hostWorkerBundleSources.js +11 -0
- package/src/host/hostWorkerBundles.js +79 -0
- package/src/host/index.js +9 -0
- package/src/host/nodeSyncFsIo.js +633 -0
- package/src/host/opfsIoBackend.js +280 -0
- package/src/host/opfsIoWorker.mjs +223 -0
- package/src/host/sabIoChannel.js +848 -0
- package/src/host/sabIoMirror.js +306 -0
- package/src/host/wasiThreadBrowserWorker.mjs +18 -11
- package/src/host/wasiThreadHost.js +258 -41
- package/src/host/wasiThreadWorker.mjs +24 -8
- package/src/host/wasiThreadWorkerRuntime.js +54 -0
- package/src/index.d.ts +347 -0
package/src/index.d.ts
CHANGED
|
@@ -2063,6 +2063,353 @@ export function createSabHostcallServer(options: {
|
|
|
2063
2063
|
dispatch: (operation: string, params: unknown) => Promise<unknown> | unknown;
|
|
2064
2064
|
}): { handleRequest(request: { operation: string; params?: unknown }): Promise<void> };
|
|
2065
2065
|
|
|
2066
|
+
// --- FlatSQL partition store host I/O (T9; docs/isomorphic-pthreads.md) ---
|
|
2067
|
+
export const DEFAULT_FLATSQL_IO_CHUNK_BYTES: number;
|
|
2068
|
+
export const DEFAULT_FLATSQL_IO_SPIN_MICROS: number;
|
|
2069
|
+
export const DEFAULT_SAB_IO_CLIENT_SPIN_MICROS: number;
|
|
2070
|
+
export const DEFAULT_SAB_IO_DATA_BYTES: number;
|
|
2071
|
+
export const DEFAULT_SAB_IO_MAX_INSTANCES: number;
|
|
2072
|
+
export const DEFAULT_SAB_IO_SLOTS: number;
|
|
2073
|
+
export const FLATSQL_IO_CREATE: number;
|
|
2074
|
+
export const FLATSQL_IO_CREATE_PARENTS: number;
|
|
2075
|
+
export const FLATSQL_IO_DELETE_ON_CLOSE: number;
|
|
2076
|
+
export const FLATSQL_IO_ERR_ACCESS: number;
|
|
2077
|
+
export const FLATSQL_IO_ERR_BADHANDLE: number;
|
|
2078
|
+
export const FLATSQL_IO_ERR_BUSY: number;
|
|
2079
|
+
export const FLATSQL_IO_ERR_GENERIC: number;
|
|
2080
|
+
export const FLATSQL_IO_ERR_IO: number;
|
|
2081
|
+
export const FLATSQL_IO_ERR_NOENT: number;
|
|
2082
|
+
export const FLATSQL_IO_ERR_NOSPACE: number;
|
|
2083
|
+
export const FLATSQL_IO_EXCL: number;
|
|
2084
|
+
export const FLATSQL_IO_MAX_PATH_BYTES: number;
|
|
2085
|
+
export const FLATSQL_IO_OK: number;
|
|
2086
|
+
export const FLATSQL_IO_OPEN_DEFERRED: number;
|
|
2087
|
+
export const FLATSQL_IO_PROBE: number;
|
|
2088
|
+
export const FLATSQL_IO_READ: number;
|
|
2089
|
+
export const FLATSQL_IO_SERVER_CREATE_FLAGS: number;
|
|
2090
|
+
export const FLATSQL_IO_TRUNC: number;
|
|
2091
|
+
export const FLATSQL_IO_UNLINK: number;
|
|
2092
|
+
export const FLATSQL_IO_UNLINK_IF_UNUSED: number;
|
|
2093
|
+
export const FLATSQL_IO_WRITE: number;
|
|
2094
|
+
export const NODE_SYNC_FS_ANONYMOUS_INSTANCE: number;
|
|
2095
|
+
export const SAB_IO_DATA_MEMORY: number;
|
|
2096
|
+
export const SAB_IO_DATA_SLOT: number;
|
|
2097
|
+
export const SAB_IO_DOORBELL_ATOMICS: number;
|
|
2098
|
+
export const SAB_IO_DOORBELL_MESSAGE: number;
|
|
2099
|
+
export const SAB_IO_H_CHANNEL_ID: number;
|
|
2100
|
+
export const SAB_IO_H_CLAIM_HINT: number;
|
|
2101
|
+
export const SAB_IO_H_DATA_BYTES: number;
|
|
2102
|
+
export const SAB_IO_H_DOORBELL: number;
|
|
2103
|
+
export const SAB_IO_H_DOORBELL_MODE: number;
|
|
2104
|
+
export const SAB_IO_H_MAGIC: number;
|
|
2105
|
+
export const SAB_IO_H_MAX_INSTANCES: number;
|
|
2106
|
+
export const SAB_IO_H_SERVED: number;
|
|
2107
|
+
export const SAB_IO_H_SERVER_EPOCH: number;
|
|
2108
|
+
export const SAB_IO_H_SERVER_STATE: number;
|
|
2109
|
+
export const SAB_IO_H_SLOT_BYTES: number;
|
|
2110
|
+
export const SAB_IO_H_SLOT_COUNT: number;
|
|
2111
|
+
export const SAB_IO_H_SLOT_RELEASES: number;
|
|
2112
|
+
export const SAB_IO_H_VERSION: number;
|
|
2113
|
+
export const SAB_IO_INSTANCE_ATTACHED: number;
|
|
2114
|
+
export const SAB_IO_INSTANCE_NONE: number;
|
|
2115
|
+
export const SAB_IO_INSTANCE_REVOKED: number;
|
|
2116
|
+
export const SAB_IO_INSTANCE_REVOKING: number;
|
|
2117
|
+
export const SAB_IO_MAGIC: number;
|
|
2118
|
+
export const SAB_IO_NOTIFY_ATOMICS: number;
|
|
2119
|
+
export const SAB_IO_NOTIFY_MESSAGE: number;
|
|
2120
|
+
export const SAB_IO_OP_CLOSE: number;
|
|
2121
|
+
export const SAB_IO_OP_OPEN: number;
|
|
2122
|
+
export const SAB_IO_OP_READ: number;
|
|
2123
|
+
export const SAB_IO_OP_SIZE: number;
|
|
2124
|
+
export const SAB_IO_OP_SYNC: number;
|
|
2125
|
+
export const SAB_IO_OP_TRUNCATE: number;
|
|
2126
|
+
export const SAB_IO_OP_WRITE: number;
|
|
2127
|
+
export const SAB_IO_SCRATCH_INSTANCE: number;
|
|
2128
|
+
export const SAB_IO_SERVER_DEAD: number;
|
|
2129
|
+
export const SAB_IO_SERVER_NOT_STARTED: number;
|
|
2130
|
+
export const SAB_IO_SERVER_RUNNING: number;
|
|
2131
|
+
export const SAB_IO_SERVER_STOPPED: number;
|
|
2132
|
+
export const SAB_IO_SLOT_DONE: number;
|
|
2133
|
+
export const SAB_IO_SLOT_FREE: number;
|
|
2134
|
+
export const SAB_IO_SLOT_IDLE: number;
|
|
2135
|
+
export const SAB_IO_SLOT_PENDING: number;
|
|
2136
|
+
export const SAB_IO_SLOT_SERVICING: number;
|
|
2137
|
+
export const SAB_IO_STATUS_DEAD: number;
|
|
2138
|
+
export const SAB_IO_STATUS_REVOKED: number;
|
|
2139
|
+
export const SAB_IO_S_DATA_MODE: number;
|
|
2140
|
+
export const SAB_IO_S_DONE_SEQ: number;
|
|
2141
|
+
export const SAB_IO_S_F64_OFFSET: number;
|
|
2142
|
+
export const SAB_IO_S_F64_RESULT: number;
|
|
2143
|
+
export const SAB_IO_S_FLAGS: number;
|
|
2144
|
+
export const SAB_IO_S_HANDLE: number;
|
|
2145
|
+
export const SAB_IO_S_INSTANCE: number;
|
|
2146
|
+
export const SAB_IO_S_LEN: number;
|
|
2147
|
+
export const SAB_IO_S_NOTIFY: number;
|
|
2148
|
+
export const SAB_IO_S_OP: number;
|
|
2149
|
+
export const SAB_IO_S_OWNER: number;
|
|
2150
|
+
export const SAB_IO_S_PATH_LEN: number;
|
|
2151
|
+
export const SAB_IO_S_PTR: number;
|
|
2152
|
+
export const SAB_IO_S_SEQ: number;
|
|
2153
|
+
export const SAB_IO_S_STATE: number;
|
|
2154
|
+
export const SAB_IO_S_STATUS: number;
|
|
2155
|
+
export const SAB_IO_VERSION: number;
|
|
2156
|
+
export const SAB_IO_WAIT_SLICE_MS: number;
|
|
2157
|
+
export const FLATSQL_IO_IMPORT_MODULE: string;
|
|
2158
|
+
export const FLATSQL_IO_PROVIDER_DESCRIPTOR: string;
|
|
2159
|
+
export const FLATSQL_IO_WORKER_FILENAME: string;
|
|
2160
|
+
export const NODE_SYNC_FS_PROVIDER_DESCRIPTOR: string;
|
|
2161
|
+
export const OPFS_SHARED_HANDLE_MODE: string;
|
|
2162
|
+
export const FLATSQL_IO_FLAGS: Readonly<Record<string, number>>;
|
|
2163
|
+
export const FLATSQL_IO_STATUS: Readonly<Record<string, number>>;
|
|
2164
|
+
export const FLATSQL_IO_IMPORT_NAMES: readonly string[];
|
|
2165
|
+
export const FLATSQL_IO_TRACE_OPS: Readonly<Record<string, number>>;
|
|
2166
|
+
|
|
2167
|
+
/** Synchronous provider behind the seven env.flatsql_io_* imports. */
|
|
2168
|
+
export interface FlatsqlIoProvider {
|
|
2169
|
+
open(path: Uint8Array | string, flags: number): number;
|
|
2170
|
+
read(handle: number, ptr: number, len: number, offset: number): number;
|
|
2171
|
+
write(handle: number, ptr: number, len: number, offset: number): number;
|
|
2172
|
+
truncate(handle: number, size: number): number;
|
|
2173
|
+
sync(handle: number): number;
|
|
2174
|
+
size(handle: number): number;
|
|
2175
|
+
close(handle: number): number;
|
|
2176
|
+
}
|
|
2177
|
+
export interface FlatsqlIoSyncClient extends FlatsqlIoProvider {
|
|
2178
|
+
readonly instanceId: number;
|
|
2179
|
+
readonly requests: number;
|
|
2180
|
+
readInto(handle: number, view: Uint8Array, offset: number): number;
|
|
2181
|
+
writeFrom(handle: number, view: Uint8Array, offset: number): number;
|
|
2182
|
+
release(): void;
|
|
2183
|
+
}
|
|
2184
|
+
export interface FlatsqlIoAsyncClient {
|
|
2185
|
+
readonly instanceId: number;
|
|
2186
|
+
open(path: Uint8Array | string, flags: number): Promise<number>;
|
|
2187
|
+
read(handle: number, length: number, offset: number): Promise<Uint8Array | number>;
|
|
2188
|
+
write(handle: number, bytes: Uint8Array, offset: number): Promise<number>;
|
|
2189
|
+
truncate(handle: number, size: number): Promise<number>;
|
|
2190
|
+
sync(handle: number): Promise<number>;
|
|
2191
|
+
size(handle: number): Promise<number>;
|
|
2192
|
+
close(handle: number): Promise<number>;
|
|
2193
|
+
close$(): void;
|
|
2194
|
+
}
|
|
2195
|
+
export interface FlatsqlIoBackendFile {
|
|
2196
|
+
read(view: Uint8Array, options?: { at?: number }): number;
|
|
2197
|
+
write(view: Uint8Array, options?: { at?: number }): number;
|
|
2198
|
+
truncate(size: number): void;
|
|
2199
|
+
flush(): void;
|
|
2200
|
+
getSize(): number;
|
|
2201
|
+
close(): void;
|
|
2202
|
+
}
|
|
2203
|
+
export interface FlatsqlIoBackend {
|
|
2204
|
+
kind: string;
|
|
2205
|
+
init?(): Promise<Record<string, unknown>>;
|
|
2206
|
+
openFile(path: string, components: string[], flags: number): FlatsqlIoBackendFile | Promise<FlatsqlIoBackendFile>;
|
|
2207
|
+
exists(path: string, components: string[]): boolean | Promise<boolean>;
|
|
2208
|
+
remove(path: string, components: string[]): void | Promise<void>;
|
|
2209
|
+
}
|
|
2210
|
+
export interface FlatsqlIoMirrorOptions {
|
|
2211
|
+
buffer: SharedArrayBuffer;
|
|
2212
|
+
suffixes?: string[];
|
|
2213
|
+
write?: boolean;
|
|
2214
|
+
}
|
|
2215
|
+
export type FlatsqlIoExtraImport =
|
|
2216
|
+
| { provider: "flatsql-io"; instanceId?: number; channels: SharedArrayBuffer[]; mirror?: FlatsqlIoMirrorOptions; trace?: { buffer: SharedArrayBuffer } }
|
|
2217
|
+
| { provider: "flatsql-io-node"; root: string; table: SharedArrayBuffer; instanceId?: number; mirror?: FlatsqlIoMirrorOptions; trace?: { buffer: SharedArrayBuffer } }
|
|
2218
|
+
| { moduleUrl: string; exportName?: string; config?: unknown };
|
|
2219
|
+
|
|
2220
|
+
export class FlatsqlIoStatusError extends Error {
|
|
2221
|
+
constructor(status: number, message?: string);
|
|
2222
|
+
status: number;
|
|
2223
|
+
}
|
|
2224
|
+
export function flatsqlIoStatusForError(error: unknown, options?: { during?: "open" }): number;
|
|
2225
|
+
export function flatsqlIoStatusOf(error: unknown, options?: { during?: "open" }): number;
|
|
2226
|
+
export function splitFlatsqlIoPath(path: string): string[] | number;
|
|
2227
|
+
export function decodeFlatsqlIoPath(bytes: Uint8Array): string | number;
|
|
2228
|
+
export function hashFlatsqlIoPath(bytes: Uint8Array): number;
|
|
2229
|
+
|
|
2230
|
+
export function createSabIoChannelBuffer(options?: { slots?: number; dataBytes?: number; maxInstances?: number }): SharedArrayBuffer;
|
|
2231
|
+
export function describeSabIoChannel(buffer: SharedArrayBuffer): Record<string, unknown>;
|
|
2232
|
+
export function sabIoDoorbellChannelName(channelId: number): string;
|
|
2233
|
+
export function sabIoCompletionChannelName(channelId: number): string;
|
|
2234
|
+
export function createSabIoClient(options: { buffer: SharedArrayBuffer; instanceId?: number; getMemory?: () => WebAssembly.Memory | null; spinMicros?: number }): FlatsqlIoSyncClient;
|
|
2235
|
+
export function createSabIoAsyncClient(options: { buffer: SharedArrayBuffer; instanceId?: number; forceMessages?: boolean }): FlatsqlIoAsyncClient;
|
|
2236
|
+
export function sabIoInstanceState(buffer: SharedArrayBuffer, instanceId: number): number;
|
|
2237
|
+
export function revokeSabIoInstance(buffer: SharedArrayBuffer, instanceId: number, options?: { pollMs?: number }): Promise<void>;
|
|
2238
|
+
export function resetSabIoInstance(buffer: SharedArrayBuffer, instanceId: number): void;
|
|
2239
|
+
export function failPendingSabIoRequests(buffer: SharedArrayBuffer, status?: number): number;
|
|
2240
|
+
export function reclaimSabIoSlots(buffer: SharedArrayBuffer, instanceId: number): number;
|
|
2241
|
+
export function completeSabIoSlot(layout: unknown, slot: unknown, status: number, f64Result?: number): void;
|
|
2242
|
+
|
|
2243
|
+
export function createSabIoMirrorBuffer(options?: { entries?: number; entryBytes?: number; maxPathBytes?: number }): SharedArrayBuffer;
|
|
2244
|
+
export function sabIoMirrorEntryBytes(buffer: SharedArrayBuffer): number;
|
|
2245
|
+
export function findSabIoMirrorEntry(buffer: SharedArrayBuffer, path: string | Uint8Array): number;
|
|
2246
|
+
export function updateSabIoMirror(buffer: SharedArrayBuffer, path: string | Uint8Array, offset: number, bytes: Uint8Array, options?: { truncateTo?: number }): boolean;
|
|
2247
|
+
export function clearSabIoMirror(buffer: SharedArrayBuffer, path: string | Uint8Array): void;
|
|
2248
|
+
export function readSabIoMirror(buffer: SharedArrayBuffer, path: string | Uint8Array, dst: Uint8Array, offset: number): number;
|
|
2249
|
+
export function readSabIoMirrorEntry(buffer: SharedArrayBuffer, index: number, dst: Uint8Array, offset: number): number;
|
|
2250
|
+
export function createSabIoMirrorMatcher(suffixes?: string[]): (path: string) => boolean;
|
|
2251
|
+
|
|
2252
|
+
export function createFlatsqlIoImports(options: {
|
|
2253
|
+
getMemory: () => WebAssembly.Memory;
|
|
2254
|
+
provider: FlatsqlIoProvider | FlatsqlIoProvider[];
|
|
2255
|
+
mirror?: FlatsqlIoMirrorOptions;
|
|
2256
|
+
trace?: { buffer: SharedArrayBuffer };
|
|
2257
|
+
}): { env: Record<string, (...args: number[]) => number> };
|
|
2258
|
+
export function resolveFlatsqlIoDescriptor(descriptor: FlatsqlIoExtraImport, ctx: { getMemory: () => WebAssembly.Memory }): { imports: WebAssembly.Imports; close(): void };
|
|
2259
|
+
export function resolveExtraImports(extraImports: Array<FlatsqlIoExtraImport | ((ctx: unknown) => unknown)>, ctx: { memory: WebAssembly.Memory; getMemory: () => WebAssembly.Memory; tid?: number | null; workerIndex?: number | null }): { fragments: WebAssembly.Imports[]; close(): void };
|
|
2260
|
+
export function mergeImportFragments(imports: WebAssembly.Imports, fragments: WebAssembly.Imports[]): WebAssembly.Imports;
|
|
2261
|
+
export function createFlatsqlIoTraceBuffer(capacity?: number): SharedArrayBuffer;
|
|
2262
|
+
export function readFlatsqlIoTrace(buffer: SharedArrayBuffer): { recorded: number; capacity: number; samples: Array<{ op: number; micros: number }> };
|
|
2263
|
+
|
|
2264
|
+
export interface FlatsqlIoServer {
|
|
2265
|
+
readonly doorbellMode: number;
|
|
2266
|
+
readonly stats: Record<string, number | boolean>;
|
|
2267
|
+
start(): Promise<void>;
|
|
2268
|
+
stop(): Promise<void>;
|
|
2269
|
+
attachMemory(instanceId: number, memory: WebAssembly.Memory | SharedArrayBuffer): boolean;
|
|
2270
|
+
detachMemory(instanceId: number): void;
|
|
2271
|
+
preopen(paths: string[], flags?: number): Promise<number[]>;
|
|
2272
|
+
releasePreopen(paths: string[]): void;
|
|
2273
|
+
inventory(): { files: Array<{ path: string; refs: number; pins: number; opening: boolean; openStatus: number }>; handles: number };
|
|
2274
|
+
}
|
|
2275
|
+
export function createFlatsqlIoServer(options: {
|
|
2276
|
+
buffer: SharedArrayBuffer;
|
|
2277
|
+
backend: FlatsqlIoBackend;
|
|
2278
|
+
chunkBytes?: number;
|
|
2279
|
+
doorbell?: "auto" | "atomics" | "message";
|
|
2280
|
+
mirror?: { buffer: SharedArrayBuffer; match(path: string): boolean; write?: boolean };
|
|
2281
|
+
spinMicros?: number;
|
|
2282
|
+
onEvent?: (event: Record<string, unknown>) => void;
|
|
2283
|
+
}): FlatsqlIoServer;
|
|
2284
|
+
export function createFlatsqlIoMemoryBackend(options?: { maxBytes?: number }): FlatsqlIoBackend & {
|
|
2285
|
+
reset(): void;
|
|
2286
|
+
usage(): { files: number; allocatedBytes: number };
|
|
2287
|
+
list(): string[];
|
|
2288
|
+
};
|
|
2289
|
+
export function createOpfsIoBackend(options?: {
|
|
2290
|
+
rootDirectory?: string;
|
|
2291
|
+
handleMode?: "auto" | "shared" | "exclusive";
|
|
2292
|
+
openDelayMs?: (path: string) => number;
|
|
2293
|
+
root?: unknown;
|
|
2294
|
+
busyRetry?: { attempts: number; baseMs?: number };
|
|
2295
|
+
}): FlatsqlIoBackend & { readonly sharedModes: boolean; readonly sharedViews: boolean | null; clear(): Promise<void> };
|
|
2296
|
+
export function probeOpfsSharedHandleModes(root: unknown, name?: string): Promise<{ supported: boolean; detail: string }>;
|
|
2297
|
+
export function probeOpfsSharedViews(root: unknown, name?: string): Promise<boolean>;
|
|
2298
|
+
|
|
2299
|
+
export class FlatsqlIoWorkerStartError extends Error {
|
|
2300
|
+
lockUnavailable?: boolean;
|
|
2301
|
+
}
|
|
2302
|
+
export interface FlatsqlIoWorkerController {
|
|
2303
|
+
readonly buffer: SharedArrayBuffer;
|
|
2304
|
+
readonly info: Record<string, unknown> | null;
|
|
2305
|
+
readonly dead: boolean;
|
|
2306
|
+
readonly restarts: number;
|
|
2307
|
+
readonly worker: unknown;
|
|
2308
|
+
attachMemory(instanceId: number, memory: WebAssembly.Memory | SharedArrayBuffer): Promise<boolean>;
|
|
2309
|
+
detachMemory(instanceId: number): void;
|
|
2310
|
+
revoke(instanceId: number): Promise<void>;
|
|
2311
|
+
preopen(paths: string[], flags?: number): Promise<number[]>;
|
|
2312
|
+
releasePreopen(paths: string[]): void;
|
|
2313
|
+
stats(): Promise<Record<string, unknown>>;
|
|
2314
|
+
reset(): Promise<void>;
|
|
2315
|
+
clear(): Promise<unknown>;
|
|
2316
|
+
stop(): Promise<void>;
|
|
2317
|
+
kill(): void;
|
|
2318
|
+
}
|
|
2319
|
+
export function createFlatsqlIoWorker(options?: {
|
|
2320
|
+
buffer?: SharedArrayBuffer;
|
|
2321
|
+
channel?: { slots?: number; dataBytes?: number; maxInstances?: number };
|
|
2322
|
+
backend?: "opfs" | "memory";
|
|
2323
|
+
role?: "writer" | "reader";
|
|
2324
|
+
chunkBytes?: number;
|
|
2325
|
+
doorbell?: "auto" | "atomics" | "message";
|
|
2326
|
+
mirror?: FlatsqlIoMirrorOptions;
|
|
2327
|
+
rootDirectory?: string;
|
|
2328
|
+
handleMode?: "auto" | "shared" | "exclusive";
|
|
2329
|
+
memoryMaxBytes?: number;
|
|
2330
|
+
openDelay?: { pattern: string; ms: number } | null;
|
|
2331
|
+
lock?: { name: string; ifAvailable?: boolean } | null;
|
|
2332
|
+
busyRetry?: { attempts: number; baseMs?: number } | null;
|
|
2333
|
+
workerUrl?: string | URL;
|
|
2334
|
+
workerType?: "module" | "classic";
|
|
2335
|
+
onError?: (error: unknown, info: { restarted: boolean; failedRequests: number }) => void;
|
|
2336
|
+
restart?: boolean;
|
|
2337
|
+
}): Promise<FlatsqlIoWorkerController>;
|
|
2338
|
+
|
|
2339
|
+
export const FLATSQL_IO_CONFORMANCE_CASES: ReadonlyArray<{ name: string; run(io: unknown, dir: string): Promise<void> }>;
|
|
2340
|
+
export function runFlatsqlIoConformance(io: unknown, options?: { prefix?: string; skip?: string[] }): Promise<{ passed: string[]; failed: Array<{ name: string; error: string }>; skipped: string[] }>;
|
|
2341
|
+
export function conformanceAdapterForAsyncClient(client: FlatsqlIoAsyncClient): unknown;
|
|
2342
|
+
|
|
2343
|
+
export function probeWorkerCapabilities(): Promise<Record<string, unknown>>;
|
|
2344
|
+
export function workerCapabilityProbeSource(): string;
|
|
2345
|
+
export function probeBrowserCapabilities(options?: { timeoutMs?: number }): Promise<{
|
|
2346
|
+
page: Record<string, unknown>;
|
|
2347
|
+
worker: Record<string, unknown> | null;
|
|
2348
|
+
localStore: { supported: boolean; missing: string[]; doorbell: "atomics" | "message"; transfer: "direct" | "scratch" };
|
|
2349
|
+
}>;
|
|
2350
|
+
export function flatsqlLocalStoreGate(matrix: { page: Record<string, unknown>; worker: Record<string, unknown> | null }): {
|
|
2351
|
+
supported: boolean;
|
|
2352
|
+
missing: string[];
|
|
2353
|
+
doorbell: "atomics" | "message";
|
|
2354
|
+
transfer: "direct" | "scratch";
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
export function createNodeSyncFsIoTable(options?: { maxHandles?: number; maxPathBytes?: number; maxInstances?: number }): SharedArrayBuffer;
|
|
2358
|
+
export function createNodeSyncFsIo(options: {
|
|
2359
|
+
root: string;
|
|
2360
|
+
table: SharedArrayBuffer;
|
|
2361
|
+
instanceId?: number;
|
|
2362
|
+
getMemory?: () => WebAssembly.Memory | null;
|
|
2363
|
+
interpose?: (op: string, fn: (...args: unknown[]) => unknown, args: unknown[]) => unknown;
|
|
2364
|
+
}): FlatsqlIoProvider & {
|
|
2365
|
+
readInto(handle: number, view: Uint8Array, offset: number): number;
|
|
2366
|
+
writeFrom(handle: number, view: Uint8Array, offset: number): number;
|
|
2367
|
+
closeLocalFds(): void;
|
|
2368
|
+
liveHandles(): number;
|
|
2369
|
+
localFdCount(): number;
|
|
2370
|
+
};
|
|
2371
|
+
export function revokeNodeSyncFsIoInstance(table: SharedArrayBuffer, instanceId: number): void;
|
|
2372
|
+
export function resetNodeSyncFsIoInstance(table: SharedArrayBuffer, instanceId: number): void;
|
|
2373
|
+
export function resolveNodeFlatsqlIoDescriptors(entries: unknown[]): unknown[];
|
|
2374
|
+
|
|
2375
|
+
export interface WasiThreadSpawnReport {
|
|
2376
|
+
poolSize: number | null;
|
|
2377
|
+
armed: number;
|
|
2378
|
+
failedToArm: number;
|
|
2379
|
+
spawned: number;
|
|
2380
|
+
declined: number;
|
|
2381
|
+
declinedByReason: Record<string, number>;
|
|
2382
|
+
lastDeclineReason: string | null;
|
|
2383
|
+
active: number;
|
|
2384
|
+
idle?: number;
|
|
2385
|
+
}
|
|
2386
|
+
export function isWasiThreadsModule(wasmModule: WebAssembly.Module): boolean;
|
|
2387
|
+
export function createWasiThreadSpawn(options: {
|
|
2388
|
+
wasmModule: WebAssembly.Module;
|
|
2389
|
+
memory: WebAssembly.Memory;
|
|
2390
|
+
requestedThreads?: number;
|
|
2391
|
+
poolSize?: number;
|
|
2392
|
+
extraImports?: FlatsqlIoExtraImport[];
|
|
2393
|
+
instanceId?: number;
|
|
2394
|
+
onGuestError?: (instanceId: number | null, tid: number | null, error: unknown) => void;
|
|
2395
|
+
onSpawnDeclined?: (event: { reason: string; poolSize: number | null; declined: number }) => void;
|
|
2396
|
+
probeTimeoutMs?: number;
|
|
2397
|
+
hostcallChannel?: unknown;
|
|
2398
|
+
processState?: unknown;
|
|
2399
|
+
requiresHostcalls?: boolean;
|
|
2400
|
+
enableBrowserThreads?: boolean;
|
|
2401
|
+
browserWorkerBaseUrl?: string | URL;
|
|
2402
|
+
browserWorkerUrl?: string | URL;
|
|
2403
|
+
browserWorkerType?: "module" | "classic";
|
|
2404
|
+
}): Promise<{
|
|
2405
|
+
threadSpawn(startArg: number): number;
|
|
2406
|
+
activeThreadCount(): number;
|
|
2407
|
+
spawnCount(): number;
|
|
2408
|
+
distinctOsThreadCount(): number;
|
|
2409
|
+
spawnReport(): WasiThreadSpawnReport;
|
|
2410
|
+
terminateAll(): Promise<void>;
|
|
2411
|
+
}>;
|
|
2412
|
+
|
|
2066
2413
|
// --- Browser cron/timer driver (WS6.3) ---
|
|
2067
2414
|
export interface ModuleTimerRunRecord {
|
|
2068
2415
|
timerId: string;
|