@pgxsinkit/pgwasm 0.5.0

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.
Files changed (209) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE-APACHE-2.0 +202 -0
  3. package/NOTICE +111 -0
  4. package/README.md +56 -0
  5. package/dist/build/index.d.ts +8 -0
  6. package/dist/build/index.d.ts.map +1 -0
  7. package/dist/build/index.js +21 -0
  8. package/dist/build/index.js.map +9 -0
  9. package/dist/build/seam.d.ts +174 -0
  10. package/dist/build/seam.d.ts.map +1 -0
  11. package/dist/chunk-0w227vw2.js +233 -0
  12. package/dist/chunk-0w227vw2.js.map +11 -0
  13. package/dist/chunk-74gcrk47.js +563 -0
  14. package/dist/chunk-74gcrk47.js.map +14 -0
  15. package/dist/chunk-at1py5s5.js +373 -0
  16. package/dist/chunk-at1py5s5.js.map +12 -0
  17. package/dist/chunk-cpsnmzrf.js +126 -0
  18. package/dist/chunk-cpsnmzrf.js.map +10 -0
  19. package/dist/chunk-d82gg1hx.js +306 -0
  20. package/dist/chunk-d82gg1hx.js.map +10 -0
  21. package/dist/chunk-gjf102c9.js +1005 -0
  22. package/dist/chunk-gjf102c9.js.map +16 -0
  23. package/dist/chunk-kb3rsr7n.js +19 -0
  24. package/dist/chunk-kb3rsr7n.js.map +9 -0
  25. package/dist/chunk-tdvrvgt5.js +83 -0
  26. package/dist/chunk-tdvrvgt5.js.map +11 -0
  27. package/dist/chunk-z0c40tja.js +50 -0
  28. package/dist/chunk-z0c40tja.js.map +10 -0
  29. package/dist/core/data-dir-archive.d.ts +17 -0
  30. package/dist/core/data-dir-archive.d.ts.map +1 -0
  31. package/dist/core/internals.d.ts +59 -0
  32. package/dist/core/internals.d.ts.map +1 -0
  33. package/dist/core/marker.d.ts +35 -0
  34. package/dist/core/marker.d.ts.map +1 -0
  35. package/dist/core/mutex.d.ts +9 -0
  36. package/dist/core/mutex.d.ts.map +1 -0
  37. package/dist/core/names.d.ts +11 -0
  38. package/dist/core/names.d.ts.map +1 -0
  39. package/dist/core/parse.d.ts +11 -0
  40. package/dist/core/parse.d.ts.map +1 -0
  41. package/dist/core/pgwasm.d.ts +53 -0
  42. package/dist/core/pgwasm.d.ts.map +1 -0
  43. package/dist/core/storage.d.ts +14 -0
  44. package/dist/core/storage.d.ts.map +1 -0
  45. package/dist/create.d.ts +10 -0
  46. package/dist/create.d.ts.map +1 -0
  47. package/dist/drizzle/codecs.d.ts +9 -0
  48. package/dist/drizzle/codecs.d.ts.map +1 -0
  49. package/dist/drizzle/driver.d.ts +50 -0
  50. package/dist/drizzle/driver.d.ts.map +1 -0
  51. package/dist/drizzle/index.d.ts +4 -0
  52. package/dist/drizzle/index.d.ts.map +1 -0
  53. package/dist/drizzle/index.js +261 -0
  54. package/dist/drizzle/index.js.map +12 -0
  55. package/dist/drizzle/session.d.ts +39 -0
  56. package/dist/drizzle/session.d.ts.map +1 -0
  57. package/dist/errors.d.ts +115 -0
  58. package/dist/errors.d.ts.map +1 -0
  59. package/dist/fs/base-filesystem.d.ts +118 -0
  60. package/dist/fs/base-filesystem.d.ts.map +1 -0
  61. package/dist/fs/index.d.ts +2 -0
  62. package/dist/fs/index.d.ts.map +1 -0
  63. package/dist/fs/index.js +11 -0
  64. package/dist/fs/index.js.map +9 -0
  65. package/dist/index.d.ts +8 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +53 -0
  68. package/dist/index.js.map +9 -0
  69. package/dist/interface.d.ts +165 -0
  70. package/dist/interface.d.ts.map +1 -0
  71. package/dist/live/debounce-mutex.d.ts +6 -0
  72. package/dist/live/debounce-mutex.d.ts.map +1 -0
  73. package/dist/live/format-query.d.ts +8 -0
  74. package/dist/live/format-query.d.ts.map +1 -0
  75. package/dist/live/index.d.ts +9 -0
  76. package/dist/live/index.d.ts.map +1 -0
  77. package/dist/live/index.js +601 -0
  78. package/dist/live/index.js.map +12 -0
  79. package/dist/live/interface.d.ts +86 -0
  80. package/dist/live/interface.d.ts.map +1 -0
  81. package/dist/opfs/broker/client.d.ts +163 -0
  82. package/dist/opfs/broker/client.d.ts.map +1 -0
  83. package/dist/opfs/broker/protocol.d.ts +326 -0
  84. package/dist/opfs/broker/protocol.d.ts.map +1 -0
  85. package/dist/opfs/broker/server.d.ts +84 -0
  86. package/dist/opfs/broker/server.d.ts.map +1 -0
  87. package/dist/opfs/core/checksum.d.ts +3 -0
  88. package/dist/opfs/core/checksum.d.ts.map +1 -0
  89. package/dist/opfs/core/codec.d.ts +73 -0
  90. package/dist/opfs/core/codec.d.ts.map +1 -0
  91. package/dist/opfs/core/errors.d.ts +80 -0
  92. package/dist/opfs/core/errors.d.ts.map +1 -0
  93. package/dist/opfs/core/limits.d.ts +35 -0
  94. package/dist/opfs/core/limits.d.ts.map +1 -0
  95. package/dist/opfs/core/memory-port.d.ts +51 -0
  96. package/dist/opfs/core/memory-port.d.ts.map +1 -0
  97. package/dist/opfs/core/metadata-store.d.ts +19 -0
  98. package/dist/opfs/core/metadata-store.d.ts.map +1 -0
  99. package/dist/opfs/core/mounted-vfs.d.ts +119 -0
  100. package/dist/opfs/core/mounted-vfs.d.ts.map +1 -0
  101. package/dist/opfs/core/path.d.ts +14 -0
  102. package/dist/opfs/core/path.d.ts.map +1 -0
  103. package/dist/opfs/core/port.d.ts +30 -0
  104. package/dist/opfs/core/port.d.ts.map +1 -0
  105. package/dist/opfs/core/repacked-vfs.d.ts +138 -0
  106. package/dist/opfs/core/repacked-vfs.d.ts.map +1 -0
  107. package/dist/opfs/core/state-machine.d.ts +296 -0
  108. package/dist/opfs/core/state-machine.d.ts.map +1 -0
  109. package/dist/opfs/create.d.ts +50 -0
  110. package/dist/opfs/create.d.ts.map +1 -0
  111. package/dist/opfs/file-port.d.ts +14 -0
  112. package/dist/opfs/file-port.d.ts.map +1 -0
  113. package/dist/opfs/index.d.ts +37 -0
  114. package/dist/opfs/index.d.ts.map +1 -0
  115. package/dist/opfs/index.js +6671 -0
  116. package/dist/opfs/index.js.map +28 -0
  117. package/dist/opfs/opfs-port.d.ts +34 -0
  118. package/dist/opfs/opfs-port.d.ts.map +1 -0
  119. package/dist/opfs/opfs-repacked-fs.d.ts +55 -0
  120. package/dist/opfs/opfs-repacked-fs.d.ts.map +1 -0
  121. package/dist/opfs/wasi/preview1.d.ts +228 -0
  122. package/dist/opfs/wasi/preview1.d.ts.map +1 -0
  123. package/dist/protocol/index.d.ts +15 -0
  124. package/dist/protocol/index.d.ts.map +1 -0
  125. package/dist/protocol/index.js +23 -0
  126. package/dist/protocol/index.js.map +10 -0
  127. package/dist/protocol/wire/buffer-reader.d.ts +13 -0
  128. package/dist/protocol/wire/buffer-reader.d.ts.map +1 -0
  129. package/dist/protocol/wire/buffer-writer.d.ts +12 -0
  130. package/dist/protocol/wire/buffer-writer.d.ts.map +1 -0
  131. package/dist/protocol/wire/index.d.ts +5 -0
  132. package/dist/protocol/wire/index.d.ts.map +1 -0
  133. package/dist/protocol/wire/messages.d.ts +194 -0
  134. package/dist/protocol/wire/messages.d.ts.map +1 -0
  135. package/dist/protocol/wire/parser.d.ts +12 -0
  136. package/dist/protocol/wire/parser.d.ts.map +1 -0
  137. package/dist/protocol/wire/serializer.d.ts +61 -0
  138. package/dist/protocol/wire/serializer.d.ts.map +1 -0
  139. package/dist/protocol/wire/string-utils.d.ts +6 -0
  140. package/dist/protocol/wire/string-utils.d.ts.map +1 -0
  141. package/dist/protocol/wire/types.d.ts +7 -0
  142. package/dist/protocol/wire/types.d.ts.map +1 -0
  143. package/dist/tar/gzip.d.ts +7 -0
  144. package/dist/tar/gzip.d.ts.map +1 -0
  145. package/dist/tar/tar.d.ts +39 -0
  146. package/dist/tar/tar.d.ts.map +1 -0
  147. package/dist/templating.d.ts +42 -0
  148. package/dist/templating.d.ts.map +1 -0
  149. package/dist/types.d.ts +76 -0
  150. package/dist/types.d.ts.map +1 -0
  151. package/package.json +69 -0
  152. package/skills/opfs/SKILL.md +138 -0
  153. package/src/build/index.ts +23 -0
  154. package/src/build/seam.ts +179 -0
  155. package/src/core/data-dir-archive.ts +68 -0
  156. package/src/core/internals.ts +87 -0
  157. package/src/core/marker.ts +94 -0
  158. package/src/core/mutex.ts +16 -0
  159. package/src/core/names.ts +26 -0
  160. package/src/core/parse.ts +79 -0
  161. package/src/core/pgwasm.ts +876 -0
  162. package/src/core/storage.ts +70 -0
  163. package/src/create.ts +134 -0
  164. package/src/drizzle/codecs.ts +114 -0
  165. package/src/drizzle/driver.ts +141 -0
  166. package/src/drizzle/index.ts +15 -0
  167. package/src/drizzle/session.ts +133 -0
  168. package/src/errors.ts +201 -0
  169. package/src/fs/base-filesystem.ts +149 -0
  170. package/src/fs/index.ts +7 -0
  171. package/src/index.ts +44 -0
  172. package/src/interface.ts +186 -0
  173. package/src/live/debounce-mutex.ts +45 -0
  174. package/src/live/format-query.ts +47 -0
  175. package/src/live/index.ts +707 -0
  176. package/src/live/interface.ts +109 -0
  177. package/src/opfs/broker/client.ts +482 -0
  178. package/src/opfs/broker/protocol.ts +624 -0
  179. package/src/opfs/broker/server.ts +522 -0
  180. package/src/opfs/core/checksum.ts +85 -0
  181. package/src/opfs/core/codec.ts +1051 -0
  182. package/src/opfs/core/errors.ts +134 -0
  183. package/src/opfs/core/limits.ts +68 -0
  184. package/src/opfs/core/memory-port.ts +459 -0
  185. package/src/opfs/core/metadata-store.ts +512 -0
  186. package/src/opfs/core/mounted-vfs.ts +407 -0
  187. package/src/opfs/core/path.ts +82 -0
  188. package/src/opfs/core/port.ts +114 -0
  189. package/src/opfs/core/repacked-vfs.ts +1464 -0
  190. package/src/opfs/core/state-machine.ts +1699 -0
  191. package/src/opfs/create.ts +125 -0
  192. package/src/opfs/file-port.ts +183 -0
  193. package/src/opfs/index.ts +113 -0
  194. package/src/opfs/opfs-port.ts +90 -0
  195. package/src/opfs/opfs-repacked-fs.ts +210 -0
  196. package/src/opfs/wasi/preview1.ts +1016 -0
  197. package/src/protocol/index.ts +24 -0
  198. package/src/protocol/wire/buffer-reader.ts +60 -0
  199. package/src/protocol/wire/buffer-writer.ts +93 -0
  200. package/src/protocol/wire/index.ts +15 -0
  201. package/src/protocol/wire/messages.ts +332 -0
  202. package/src/protocol/wire/parser.ts +373 -0
  203. package/src/protocol/wire/serializer.ts +233 -0
  204. package/src/protocol/wire/string-utils.ts +18 -0
  205. package/src/protocol/wire/types.ts +12 -0
  206. package/src/tar/gzip.ts +36 -0
  207. package/src/tar/tar.ts +253 -0
  208. package/src/templating.ts +103 -0
  209. package/src/types.ts +283 -0
@@ -0,0 +1,51 @@
1
+ import type { OwnedFileName, RepackedFileHandle, RepackedPort, RepackedPortEntry } from "./port";
2
+ export type MemoryOperation = "enumerate" | "acquire" | "getSize" | "read" | "write" | "truncate" | "flush";
3
+ type FaultOutcome = "short" | "throw-before" | "throw-after" | "quota";
4
+ export interface MemoryFault {
5
+ operation: MemoryOperation;
6
+ outcome: FaultOutcome;
7
+ file?: string;
8
+ label?: string;
9
+ bytes?: number;
10
+ occurrence?: number;
11
+ }
12
+ export type TerminationDecision = "absent" | "full" | number;
13
+ export interface MemoryEffectSummary {
14
+ id: number;
15
+ file: OwnedFileName;
16
+ operation: "write" | "truncate";
17
+ bytes: number;
18
+ }
19
+ export interface MemoryOperationSummary {
20
+ readonly operation: MemoryOperation;
21
+ readonly file: OwnedFileName | undefined;
22
+ readonly label: string;
23
+ /**
24
+ * Bytes this operation copied into the DURABLE image. Recorded on `flush` only, where it is the
25
+ * deterministic stand-in for flush cost: a flush must copy the bytes written since the previous
26
+ * flush, never the size of the file. Absent on every other operation.
27
+ */
28
+ readonly copiedBytes?: number;
29
+ }
30
+ export declare class MemoryRepackedPort implements RepackedPort {
31
+ #private;
32
+ get epoch(): number;
33
+ enumerate(label: string): Promise<readonly RepackedPortEntry[]>;
34
+ acquire(name: OwnedFileName, label: string): Promise<RepackedFileHandle>;
35
+ injectEntry(name: string, kind: "file" | "directory"): void;
36
+ injectFault(fault: MemoryFault): void;
37
+ pendingEffects(): readonly MemoryEffectSummary[];
38
+ openHandleCount(): number;
39
+ observedOperations(): readonly MemoryOperationSummary[];
40
+ clearObservedOperations(): void;
41
+ durableBytes(name: OwnedFileName): Uint8Array;
42
+ terminate(decisions?: Readonly<Record<number, TerminationDecision>>): void;
43
+ handleGetSize(name: OwnedFileName, label: string): number;
44
+ handleRead(name: OwnedFileName, target: Uint8Array, at: number, label: string): number;
45
+ handleWrite(name: OwnedFileName, source: Uint8Array, at: number, label: string): number;
46
+ handleTruncate(name: OwnedFileName, size: number, label: string): void;
47
+ handleFlush(name: OwnedFileName, label: string): void;
48
+ handleClose(name: OwnedFileName): void;
49
+ }
50
+ export {};
51
+ //# sourceMappingURL=memory-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-port.d.ts","sourceRoot":"","sources":["../../../src/opfs/core/memory-port.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEjG,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAC5G,KAAK,YAAY,GAAG,OAAO,GAAG,cAAc,GAAG,aAAa,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkBD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,OAAO,GAA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AI,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAYtF;IAED,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CASrE;IAED,WAAW,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAQpD;IAED,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAErC;CA2FF"}
@@ -0,0 +1,19 @@
1
+ import type { OwnedFileName, RepackedFileHandle, RepackedPort } from "./port";
2
+ import type { VfsState } from "./state-machine";
3
+ export interface OpenedMetadataStore {
4
+ handles: Record<OwnedFileName, RepackedFileHandle>;
5
+ state: VfsState;
6
+ activeLogEnd: bigint;
7
+ nextSequence: bigint;
8
+ activeLogBytes: number;
9
+ activeLogFrames: number;
10
+ activationSequence: bigint;
11
+ arenaHighWaterExtents: bigint;
12
+ arenaSize: number;
13
+ arenaDirty: boolean;
14
+ activeMetadataDirty: boolean;
15
+ }
16
+ export declare function openMetadataStore(port: RepackedPort, options: {
17
+ extentSize?: number;
18
+ }): Promise<OpenedMetadataStore>;
19
+ //# sourceMappingURL=metadata-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-store.d.ts","sourceRoot":"","sources":["../../../src/opfs/core/metadata-store.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAqB,MAAM,QAAQ,CAAC;AAEjG,OAAO,KAAK,EAAgB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IACnD,KAAK,EAAE,QAAQ,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAoaD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/B,OAAO,CAAC,mBAAmB,CAAC,CAiC9B"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * `MountedRepackedVfs` — one {@link RepackedFileSystem} made of several stores, joined at path
3
+ * prefixes.
4
+ *
5
+ * ## Why
6
+ *
7
+ * A store is a single durable object: four exclusive handles, one arena, one metadata generation.
8
+ * That is exactly right for a datadir and exactly wrong for the parts of a datadir that must NOT be
9
+ * durable — a Postgres temp tablespace, an ephemeral relation, a scratch area whose whole point is
10
+ * that it never reaches the platform. A mount serves one path prefix from a SECOND store, so the
11
+ * durable root and the volatile subtree are one tree to the guest and two stores to the host.
12
+ *
13
+ * ## The shape
14
+ *
15
+ * / -> root store (OPFS: durable)
16
+ * /pgdata/... -> root store
17
+ * /scratch -> mount store (memory: nothing durable)
18
+ * /scratch/anything/... -> mount store, as "/anything/..."
19
+ *
20
+ * A mount's prefix is its root: `/scratch/a/b` reaches the mount as `/a/b`, and the prefix itself as
21
+ * `/`. The prefix directory is also created in the ROOT store, so a `readdir` of its parent lists
22
+ * it; every operation AT or BELOW the prefix is answered by the mount, so that root-side directory
23
+ * is a name and nothing more.
24
+ *
25
+ * ## What the composite owns, and what it delegates
26
+ *
27
+ * - **Symlink resolution is the composite's**, because a link is the one thing that can move a path
28
+ * from one store to another: `pg_tblspc/<oid>` lives in the root and points at `/scratch`, and
29
+ * neither store alone can resolve it (the root would resolve it against its own placeholder
30
+ * directory and find nothing there). The fast path is one `resolvePath` call on the store the
31
+ * path already routes to — if that store says the path holds no link, no link exists on it at
32
+ * all, because every entry on the path lives in that store. Only a path that really does traverse
33
+ * a link pays the component-by-component walk.
34
+ * - **Descriptors are the composite's.** Each store numbers its own fds from 3, so the composite
35
+ * hands out its own numbers and remembers which store each belongs to.
36
+ * - **`rename` across a boundary is `EXDEV`**, exactly as it is between two real filesystems: a
37
+ * rename is a metadata move inside one store and cannot span two.
38
+ * - **`strictSync()` skips a mount declared non-durable.** A memory-backed mount has nothing to make
39
+ * durable, and a store-wide sync that walked it would charge the guest for flushes that cannot
40
+ * protect anything. Durability is a property the STORAGE OWNER declares per mount; nothing here
41
+ * infers it from the port.
42
+ * - Everything else is a route plus a delegation.
43
+ */
44
+ import type { RepackReason, RepackedFileSystem, RepackedStat, RepackedVfsMetrics } from "./repacked-vfs";
45
+ /** One store served at one path prefix. */
46
+ export interface RepackedMount {
47
+ /** Absolute, canonical, and never `/`: the path the mount's own root appears at. */
48
+ readonly prefix: string;
49
+ readonly vfs: RepackedFileSystem;
50
+ /**
51
+ * Whether a store-wide `strictSync()` reaches this mount. Defaults to `true`. A volatile mount
52
+ * (memory-backed scratch) declares `false`: there is nothing to flush, and pretending otherwise
53
+ * charges every guest `fsync` for it.
54
+ */
55
+ readonly durable?: boolean;
56
+ }
57
+ export interface MountedRepackedVfsOptions {
58
+ /** The store that answers for every path no mount claims. */
59
+ readonly root: RepackedFileSystem;
60
+ readonly mounts: readonly RepackedMount[];
61
+ /** The clock used to create each mount's placeholder directory in the root. */
62
+ readonly nowMs?: () => bigint;
63
+ }
64
+ export declare class MountedRepackedVfs implements RepackedFileSystem {
65
+ #private;
66
+ constructor(options: MountedRepackedVfsOptions);
67
+ /** The mounts this composite serves, in declaration order. */
68
+ get mounts(): readonly RepackedMount[];
69
+ /** The store that answers for everything no mount claims. */
70
+ get root(): RepackedFileSystem;
71
+ /**
72
+ * The link-free composite path `path` names.
73
+ *
74
+ * The fast path asks the routed store to resolve its own view: a store that reports the path
75
+ * unchanged proves there is no link on it, because every entry on that path lives in that store.
76
+ * Anything else falls through to the careful walk, which resolves one component at a time and can
77
+ * therefore cross a boundary in either direction.
78
+ */
79
+ resolvePath(path: string, follow?: boolean): string;
80
+ /** Flushes the root and every mount the owner declared durable; a volatile mount is skipped. */
81
+ strictSync(): void;
82
+ assertHealthy(): void;
83
+ fail(cause: unknown): never;
84
+ /** The ROOT store's metrics. A mount's own are read through {@link MountedRepackedVfs.mounts}. */
85
+ metrics(): RepackedVfsMetrics;
86
+ repack(reason?: RepackReason): void;
87
+ runScheduledRepack(nowMs?: number): boolean;
88
+ close(): void;
89
+ close(fd: number): void;
90
+ stat(path: string): RepackedStat;
91
+ lstat(path: string): RepackedStat;
92
+ symlink(target: string, path: string, nowMs: bigint): void;
93
+ readlink(path: string): string;
94
+ readdir(path: string): string[];
95
+ mkdir(path: string, options: {
96
+ recursive?: boolean;
97
+ mode?: number;
98
+ nowMs: bigint;
99
+ }): void;
100
+ writeFile(path: string, data: string | Uint8Array, options: {
101
+ encoding?: string;
102
+ mode?: number;
103
+ flag?: string;
104
+ nowMs: bigint;
105
+ }): void;
106
+ readFile(path: string): Uint8Array;
107
+ truncate(path: string, size: bigint, nowMs: bigint): void;
108
+ chmod(path: string, mode: number, nowMs: bigint): void;
109
+ utimes(path: string, atimeMs: bigint, mtimeMs: bigint, ctimeMs: bigint): void;
110
+ unlink(path: string, nowMs: bigint): void;
111
+ rmdir(path: string, nowMs: bigint): void;
112
+ /** A rename is one store's metadata move; across a boundary it is `EXDEV`, as on any host. */
113
+ rename(oldPath: string, newPath: string, nowMs: bigint): void;
114
+ open(path: string, flags?: string, mode?: number, nowMs?: bigint): number;
115
+ fstat(fd: number): RepackedStat;
116
+ read(fd: number, buffer: Uint8Array, offset: number, length: number, position?: bigint): number;
117
+ write(fd: number, buffer: Uint8Array, offset: number, length: number, position: bigint | undefined, nowMs: bigint): number;
118
+ }
119
+ //# sourceMappingURL=mounted-vfs.d.ts.map
@@ -0,0 +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,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG5E;IAED,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGxC;IAED,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGvC;IAED,8FAA8F;IAC9F,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAO5D;IAID,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAM,EAAE,IAAI,SAAW,EAAE,KAAK,SAAK,GAAG,MAAM,CAMnE;IAED,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,CAG9B;IAED,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9F;IAED,KAAK,CACH,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GACZ,MAAM,CAGR;CACF"}
@@ -0,0 +1,14 @@
1
+ export declare function encodedUtf8Length(value: string): number;
2
+ export declare function validatePathComponent(component: string): number;
3
+ /**
4
+ * Validate a symbolic link's target and report its UTF-8 byte length.
5
+ *
6
+ * Targets are ABSOLUTE ONLY, and deliberately so: an absolute target resolves by restarting the
7
+ * walk at the store root, which needs no notion of "the directory the link lives in" and therefore
8
+ * survives a rename of the link. It is also all a Postgres datadir ever writes — `CREATE TABLESPACE`
9
+ * links `pg_tblspc/<oid>` at the absolute `LOCATION`. A relative target is `EINVAL`, not silently
10
+ * reinterpreted.
11
+ */
12
+ export declare function validateSymlinkTarget(target: string): number;
13
+ export declare function parsePath(path: string): string[];
14
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/opfs/core/path.ts"],"names":[],"mappings":"AA2BA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAY/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAO5D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBhD"}
@@ -0,0 +1,30 @@
1
+ import type { MetadataFile } from "./state-machine";
2
+ export declare const OWNED_FILE_NAMES: readonly ["arena.bin", "metadata-a.bin", "metadata-b.bin", "activation.bin"];
3
+ export type OwnedFileName = (typeof OWNED_FILE_NAMES)[number];
4
+ export type MetadataFileName = Extract<OwnedFileName, "metadata-a.bin" | "metadata-b.bin">;
5
+ export declare function metadataFileName(file: MetadataFile): MetadataFileName;
6
+ export interface RepackedPortEntry {
7
+ name: string;
8
+ kind: "file" | "directory";
9
+ }
10
+ export interface RepackedFileHandle {
11
+ readonly name: OwnedFileName;
12
+ getSize(label: string): number;
13
+ read(target: Uint8Array, at: number, label: string): number;
14
+ write(source: Uint8Array, at: number, label: string): number;
15
+ truncate(size: number, label: string): void;
16
+ flush(label: string): void;
17
+ close(): void;
18
+ }
19
+ export interface RepackedPort {
20
+ enumerate(label: string): Promise<readonly RepackedPortEntry[]>;
21
+ acquire(name: OwnedFileName, label: string): Promise<RepackedFileHandle>;
22
+ }
23
+ export declare class PortWriteError extends Error {
24
+ constructor(label: string);
25
+ }
26
+ export declare function readExact(handle: RepackedFileHandle, offset: bigint, length: number, maximumLength: number, label: string): Uint8Array;
27
+ export declare function writeExact(handle: RepackedFileHandle, offset: bigint, bytes: Uint8Array, label: string): void;
28
+ export declare function truncateChecked(handle: RepackedFileHandle, size: bigint, label: string): void;
29
+ export declare function arenaByteOffset(extentId: bigint, extentSize: number, withinExtent?: number): bigint;
30
+ //# sourceMappingURL=port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../../src/opfs/core/port.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,gBAAgB,YAAI,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AAC7G,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC;AAE3F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAErE;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5D,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC1E;AAED,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,KAAK,EAAE,MAAM,EAGxB;CACF;AAWD,wBAAgB,SAAS,CACvB,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,GACZ,UAAU,CAeZ;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAU7G;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE7F;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,SAAI,GAAG,MAAM,CAkB9F"}
@@ -0,0 +1,138 @@
1
+ import type { RepackedPort } from "./port";
2
+ export interface RepackedVfsOpenOptions {
3
+ /** Creation extent size: 8 KiB–16 MiB in 8 KiB steps. Defaults to 64 KiB. */
4
+ extentSize?: number;
5
+ }
6
+ export interface RepackedStat {
7
+ /**
8
+ * `symlink` is only ever reported by `lstat` — `stat` follows the link and reports its target.
9
+ * A link's `size` is the UTF-8 byte length of its target, exactly as POSIX `lstat` reports it.
10
+ */
11
+ readonly kind: "directory" | "file" | "symlink";
12
+ readonly mode: number;
13
+ readonly size: bigint;
14
+ readonly atimeMs: bigint;
15
+ readonly mtimeMs: bigint;
16
+ readonly ctimeMs: bigint;
17
+ }
18
+ export type RepackReason = "manual" | "time" | "log-bytes" | "log-frames" | "writer-limit" | "quarantine-pressure" | "quota";
19
+ export interface RepackedVfsMetrics {
20
+ readonly generation: bigint;
21
+ readonly totalExtents: bigint;
22
+ readonly availableExtents: number;
23
+ readonly quarantineExtents: number;
24
+ readonly quarantineBytes: bigint;
25
+ readonly activeLogBytes: number;
26
+ readonly activeLogFrames: number;
27
+ readonly lastRepackReason: RepackReason | null;
28
+ readonly lastRepackDurationMs: number | null;
29
+ readonly repackCount: number;
30
+ readonly pendingRepackReason: RepackReason | null;
31
+ readonly flushes: Readonly<{
32
+ amortized: number;
33
+ arena: number;
34
+ metadata: number;
35
+ zeroBarrier: number;
36
+ manifest: number;
37
+ }>;
38
+ }
39
+ /**
40
+ * The file surface of a repacked store, as a TYPE.
41
+ *
42
+ * `RepackedVfs` is the one-store implementation; {@link MountedRepackedVfs} is a composite of
43
+ * several. Everything that takes a store — the sync broker above all — takes this, so a host can
44
+ * hand it either without the two knowing about each other.
45
+ */
46
+ export interface RepackedFileSystem {
47
+ strictSync(): void;
48
+ assertHealthy(): void;
49
+ fail(cause: unknown): never;
50
+ metrics(): RepackedVfsMetrics;
51
+ repack(reason?: RepackReason): void;
52
+ runScheduledRepack(nowMs?: number): boolean;
53
+ /** The link-free absolute path `path` names; `follow` governs the final component only. */
54
+ resolvePath(path: string, follow?: boolean): string;
55
+ stat(path: string): RepackedStat;
56
+ lstat(path: string): RepackedStat;
57
+ symlink(target: string, path: string, nowMs: bigint): void;
58
+ readlink(path: string): string;
59
+ readdir(path: string): string[];
60
+ mkdir(path: string, options: {
61
+ recursive?: boolean;
62
+ mode?: number;
63
+ nowMs: bigint;
64
+ }): void;
65
+ writeFile(path: string, data: string | Uint8Array, options: {
66
+ encoding?: string;
67
+ mode?: number;
68
+ flag?: string;
69
+ nowMs: bigint;
70
+ }): void;
71
+ readFile(path: string): Uint8Array;
72
+ truncate(path: string, size: bigint, nowMs: bigint): void;
73
+ open(path: string, flags?: string, mode?: number, nowMs?: bigint): number;
74
+ fstat(fd: number): RepackedStat;
75
+ read(fd: number, buffer: Uint8Array, offset: number, length: number, position?: bigint): number;
76
+ write(fd: number, buffer: Uint8Array, offset: number, length: number, position: bigint | undefined, nowMs: bigint): number;
77
+ chmod(path: string, mode: number, nowMs: bigint): void;
78
+ utimes(path: string, atimeMs: bigint, mtimeMs: bigint, ctimeMs: bigint): void;
79
+ unlink(path: string, nowMs: bigint): void;
80
+ rmdir(path: string, nowMs: bigint): void;
81
+ rename(oldPath: string, newPath: string, nowMs: bigint): void;
82
+ close(): void;
83
+ close(fd: number): void;
84
+ }
85
+ export declare class RepackedVfs implements RepackedFileSystem {
86
+ #private;
87
+ private constructor();
88
+ static open(port: RepackedPort, options?: RepackedVfsOpenOptions): Promise<RepackedVfs>;
89
+ strictSync(): void;
90
+ assertHealthy(): void;
91
+ fail(cause: unknown): never;
92
+ cleanupFailedInit(): void;
93
+ metrics(): RepackedVfsMetrics;
94
+ repack(reason?: RepackReason): void;
95
+ runScheduledRepack(nowMs?: number): boolean;
96
+ /**
97
+ * The link-free absolute path `path` names, without touching anything. A composite VFS resolves
98
+ * across a mount boundary with it: this store answers for the part of the path it holds, stops at
99
+ * the first component it does not have, and carries the rest through verbatim.
100
+ */
101
+ resolvePath(path: string, follow?: boolean): string;
102
+ /** Follows a symbolic link on the final component; every intermediate link is always followed. */
103
+ stat(requestPath: string): RepackedStat;
104
+ /** Reports the LINK itself when the final component is one. */
105
+ lstat(requestPath: string): RepackedStat;
106
+ /** Create a symbolic link at `path` pointing at the ABSOLUTE `target`. The target is not read. */
107
+ symlink(target: string, requestPath: string, nowMs: bigint): void;
108
+ /** The target of the symbolic link at `path`. `EINVAL` when the path is not a link. */
109
+ readlink(requestPath: string): string;
110
+ readdir(requestPath: string): string[];
111
+ mkdir(requestPath: string, options: {
112
+ recursive?: boolean;
113
+ mode?: number;
114
+ nowMs: bigint;
115
+ }): void;
116
+ writeFile(requestPath: string, data: string | Uint8Array, options: {
117
+ encoding?: string;
118
+ mode?: number;
119
+ flag?: string;
120
+ nowMs: bigint;
121
+ }): void;
122
+ readFile(requestPath: string): Uint8Array;
123
+ truncate(requestPath: string, size: bigint, nowMs: bigint): void;
124
+ open(requestPath: string, flags?: string, mode?: number, nowMs?: bigint): number;
125
+ fstat(fd: number): RepackedStat;
126
+ read(fd: number, buffer: Uint8Array, offset: number, length: number, position?: bigint): number;
127
+ write(fd: number, buffer: Uint8Array, offset: number, length: number, position: bigint | undefined, nowMs: bigint): number;
128
+ chmod(requestPath: string, mode: number, nowMs: bigint): void;
129
+ utimes(requestPath: string, atimeMs: bigint, mtimeMs: bigint, ctimeMs: bigint): void;
130
+ /** Removes a file or a SYMBOLIC LINK. The final component is never followed. */
131
+ unlink(requestPath: string, nowMs: bigint): void;
132
+ rmdir(requestPath: string, nowMs: bigint): void;
133
+ /** Renames the entry itself: a symbolic link moves as a link, and its target is never followed. */
134
+ rename(oldRequestPath: string, newRequestPath: string, nowMs: bigint): void;
135
+ close(): void;
136
+ close(fd: number): void;
137
+ }
138
+ //# sourceMappingURL=repacked-vfs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repacked-vfs.d.ts","sourceRoot":"","sources":["../../../src/opfs/core/repacked-vfs.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,QAAQ,CAAC;AAsG/D,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAA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