UNPKG

@pgxsinkit/pgwasm

Version:
35 lines • 2.04 kB
/** * The build marker (ADR-0063 decision 1, build permanence). * * pgwasm records the Postgres build in every data directory it creates, as the file `PGWASM_BUILD` in * the data directory itself (next to `PG_VERSION`), so it works on every storage and travels inside * every Store backup. Its content is one line of JSON: * * {"pgwasm":1,"build":"c","dataFormat":1} * * `pgwasm` is the marker's own format version; a newer one than this release knows is unreadable * (fail closed). A directory without a marker predates marking: it is the C build's, which the build * says through `claimsUnmarkedDirectories` rather than shared code naming a build. Existing unmarked * directories are never backfilled; only a directory pgwasm creates gets a marker. */ import type { BuildIdentity, DataDirEntry } from "../build/seam"; /** The marker's path inside the data directory. */ export declare const BUILD_MARKER_PATH = "/PGWASM_BUILD"; /** Postgres' own version file: its presence means the directory holds a cluster. */ export declare const PG_VERSION_PATH = "/PG_VERSION"; /** The marker's bytes for a build. */ export declare function encodeBuildMarker(build: BuildIdentity): Uint8Array; /** Parse a marker; throws {@link BuildMarkerUnreadableError} for anything but a valid one. */ export declare function decodeBuildMarker(bytes: Uint8Array): { build: string; dataFormat: number; }; /** * Check what a data directory or backup records against the build about to open it. `marker` is the * marker's bytes (absent when there is none); `hasCluster` is whether `PG_VERSION` exists. Throws the * typed refusal when the build may not open it. */ export declare function checkBuildMarker(build: BuildIdentity, marker: Uint8Array | undefined, hasCluster: boolean, source: "data-directory" | "backup"): void; /** The marker entry of a data-directory image, if it has one. */ export declare function findEntry(entries: readonly DataDirEntry[], path: string): DataDirEntry | undefined; //# sourceMappingURL=marker.d.ts.map