UNPKG

@pgxsinkit/pgwasm

Version:
51 lines • 2.3 kB
import type { OwnedFileName, RepackedFileHandle, RepackedPort, RepackedPortEntry } from "./port"; export type MemoryOperation = "enumerate" | "acquire" | "getSize" | "read" | "write" | "truncate" | "flush"; type FaultOutcome = "short" | "throw-before" | "throw-after" | "quota"; export interface MemoryFault { operation: MemoryOperation; outcome: FaultOutcome; file?: string; label?: string; bytes?: number; occurrence?: number; } export type TerminationDecision = "absent" | "full" | number; export interface MemoryEffectSummary { id: number; file: OwnedFileName; operation: "write" | "truncate"; bytes: number; } export interface MemoryOperationSummary { readonly operation: MemoryOperation; readonly file: OwnedFileName | undefined; readonly label: string; /** * Bytes this operation copied into the DURABLE image. Recorded on `flush` only, where it is the * deterministic stand-in for flush cost: a flush must copy the bytes written since the previous * flush, never the size of the file. Absent on every other operation. */ readonly copiedBytes?: number; } export declare class MemoryRepackedPort implements RepackedPort { #private; get epoch(): number; enumerate(label: string): Promise<readonly RepackedPortEntry[]>; acquire(name: OwnedFileName, label: string): Promise<RepackedFileHandle>; injectEntry(name: string, kind: "file" | "directory"): void; injectFault(fault: MemoryFault): void; pendingEffects(): readonly MemoryEffectSummary[]; openHandleCount(): number; observedOperations(): readonly MemoryOperationSummary[]; clearObservedOperations(): void; durableBytes(name: OwnedFileName): Uint8Array; terminate(decisions?: Readonly<Record<number, TerminationDecision>>): void; handleGetSize(name: OwnedFileName, label: string): number; handleRead(name: OwnedFileName, target: Uint8Array, at: number, label: string): number; handleWrite(name: OwnedFileName, source: Uint8Array, at: number, label: string): number; handleTruncate(name: OwnedFileName, size: number, label: string): void; handleFlush(name: OwnedFileName, label: string): void; handleClose(name: OwnedFileName): void; } export {}; //# sourceMappingURL=memory-port.d.ts.map