@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.
- package/LICENSE +21 -0
- package/LICENSE-APACHE-2.0 +202 -0
- package/NOTICE +111 -0
- package/README.md +56 -0
- package/dist/build/index.d.ts +8 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +21 -0
- package/dist/build/index.js.map +9 -0
- package/dist/build/seam.d.ts +174 -0
- package/dist/build/seam.d.ts.map +1 -0
- package/dist/chunk-0w227vw2.js +233 -0
- package/dist/chunk-0w227vw2.js.map +11 -0
- package/dist/chunk-74gcrk47.js +563 -0
- package/dist/chunk-74gcrk47.js.map +14 -0
- package/dist/chunk-at1py5s5.js +373 -0
- package/dist/chunk-at1py5s5.js.map +12 -0
- package/dist/chunk-cpsnmzrf.js +126 -0
- package/dist/chunk-cpsnmzrf.js.map +10 -0
- package/dist/chunk-d82gg1hx.js +306 -0
- package/dist/chunk-d82gg1hx.js.map +10 -0
- package/dist/chunk-gjf102c9.js +1005 -0
- package/dist/chunk-gjf102c9.js.map +16 -0
- package/dist/chunk-kb3rsr7n.js +19 -0
- package/dist/chunk-kb3rsr7n.js.map +9 -0
- package/dist/chunk-tdvrvgt5.js +83 -0
- package/dist/chunk-tdvrvgt5.js.map +11 -0
- package/dist/chunk-z0c40tja.js +50 -0
- package/dist/chunk-z0c40tja.js.map +10 -0
- package/dist/core/data-dir-archive.d.ts +17 -0
- package/dist/core/data-dir-archive.d.ts.map +1 -0
- package/dist/core/internals.d.ts +59 -0
- package/dist/core/internals.d.ts.map +1 -0
- package/dist/core/marker.d.ts +35 -0
- package/dist/core/marker.d.ts.map +1 -0
- package/dist/core/mutex.d.ts +9 -0
- package/dist/core/mutex.d.ts.map +1 -0
- package/dist/core/names.d.ts +11 -0
- package/dist/core/names.d.ts.map +1 -0
- package/dist/core/parse.d.ts +11 -0
- package/dist/core/parse.d.ts.map +1 -0
- package/dist/core/pgwasm.d.ts +53 -0
- package/dist/core/pgwasm.d.ts.map +1 -0
- package/dist/core/storage.d.ts +14 -0
- package/dist/core/storage.d.ts.map +1 -0
- package/dist/create.d.ts +10 -0
- package/dist/create.d.ts.map +1 -0
- package/dist/drizzle/codecs.d.ts +9 -0
- package/dist/drizzle/codecs.d.ts.map +1 -0
- package/dist/drizzle/driver.d.ts +50 -0
- package/dist/drizzle/driver.d.ts.map +1 -0
- package/dist/drizzle/index.d.ts +4 -0
- package/dist/drizzle/index.d.ts.map +1 -0
- package/dist/drizzle/index.js +261 -0
- package/dist/drizzle/index.js.map +12 -0
- package/dist/drizzle/session.d.ts +39 -0
- package/dist/drizzle/session.d.ts.map +1 -0
- package/dist/errors.d.ts +115 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/fs/base-filesystem.d.ts +118 -0
- package/dist/fs/base-filesystem.d.ts.map +1 -0
- package/dist/fs/index.d.ts +2 -0
- package/dist/fs/index.d.ts.map +1 -0
- package/dist/fs/index.js +11 -0
- package/dist/fs/index.js.map +9 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +9 -0
- package/dist/interface.d.ts +165 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/live/debounce-mutex.d.ts +6 -0
- package/dist/live/debounce-mutex.d.ts.map +1 -0
- package/dist/live/format-query.d.ts +8 -0
- package/dist/live/format-query.d.ts.map +1 -0
- package/dist/live/index.d.ts +9 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +601 -0
- package/dist/live/index.js.map +12 -0
- package/dist/live/interface.d.ts +86 -0
- package/dist/live/interface.d.ts.map +1 -0
- package/dist/opfs/broker/client.d.ts +163 -0
- package/dist/opfs/broker/client.d.ts.map +1 -0
- package/dist/opfs/broker/protocol.d.ts +326 -0
- package/dist/opfs/broker/protocol.d.ts.map +1 -0
- package/dist/opfs/broker/server.d.ts +84 -0
- package/dist/opfs/broker/server.d.ts.map +1 -0
- package/dist/opfs/core/checksum.d.ts +3 -0
- package/dist/opfs/core/checksum.d.ts.map +1 -0
- package/dist/opfs/core/codec.d.ts +73 -0
- package/dist/opfs/core/codec.d.ts.map +1 -0
- package/dist/opfs/core/errors.d.ts +80 -0
- package/dist/opfs/core/errors.d.ts.map +1 -0
- package/dist/opfs/core/limits.d.ts +35 -0
- package/dist/opfs/core/limits.d.ts.map +1 -0
- package/dist/opfs/core/memory-port.d.ts +51 -0
- package/dist/opfs/core/memory-port.d.ts.map +1 -0
- package/dist/opfs/core/metadata-store.d.ts +19 -0
- package/dist/opfs/core/metadata-store.d.ts.map +1 -0
- package/dist/opfs/core/mounted-vfs.d.ts +119 -0
- package/dist/opfs/core/mounted-vfs.d.ts.map +1 -0
- package/dist/opfs/core/path.d.ts +14 -0
- package/dist/opfs/core/path.d.ts.map +1 -0
- package/dist/opfs/core/port.d.ts +30 -0
- package/dist/opfs/core/port.d.ts.map +1 -0
- package/dist/opfs/core/repacked-vfs.d.ts +138 -0
- package/dist/opfs/core/repacked-vfs.d.ts.map +1 -0
- package/dist/opfs/core/state-machine.d.ts +296 -0
- package/dist/opfs/core/state-machine.d.ts.map +1 -0
- package/dist/opfs/create.d.ts +50 -0
- package/dist/opfs/create.d.ts.map +1 -0
- package/dist/opfs/file-port.d.ts +14 -0
- package/dist/opfs/file-port.d.ts.map +1 -0
- package/dist/opfs/index.d.ts +37 -0
- package/dist/opfs/index.d.ts.map +1 -0
- package/dist/opfs/index.js +6671 -0
- package/dist/opfs/index.js.map +28 -0
- package/dist/opfs/opfs-port.d.ts +34 -0
- package/dist/opfs/opfs-port.d.ts.map +1 -0
- package/dist/opfs/opfs-repacked-fs.d.ts +55 -0
- package/dist/opfs/opfs-repacked-fs.d.ts.map +1 -0
- package/dist/opfs/wasi/preview1.d.ts +228 -0
- package/dist/opfs/wasi/preview1.d.ts.map +1 -0
- package/dist/protocol/index.d.ts +15 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +23 -0
- package/dist/protocol/index.js.map +10 -0
- package/dist/protocol/wire/buffer-reader.d.ts +13 -0
- package/dist/protocol/wire/buffer-reader.d.ts.map +1 -0
- package/dist/protocol/wire/buffer-writer.d.ts +12 -0
- package/dist/protocol/wire/buffer-writer.d.ts.map +1 -0
- package/dist/protocol/wire/index.d.ts +5 -0
- package/dist/protocol/wire/index.d.ts.map +1 -0
- package/dist/protocol/wire/messages.d.ts +194 -0
- package/dist/protocol/wire/messages.d.ts.map +1 -0
- package/dist/protocol/wire/parser.d.ts +12 -0
- package/dist/protocol/wire/parser.d.ts.map +1 -0
- package/dist/protocol/wire/serializer.d.ts +61 -0
- package/dist/protocol/wire/serializer.d.ts.map +1 -0
- package/dist/protocol/wire/string-utils.d.ts +6 -0
- package/dist/protocol/wire/string-utils.d.ts.map +1 -0
- package/dist/protocol/wire/types.d.ts +7 -0
- package/dist/protocol/wire/types.d.ts.map +1 -0
- package/dist/tar/gzip.d.ts +7 -0
- package/dist/tar/gzip.d.ts.map +1 -0
- package/dist/tar/tar.d.ts +39 -0
- package/dist/tar/tar.d.ts.map +1 -0
- package/dist/templating.d.ts +42 -0
- package/dist/templating.d.ts.map +1 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +69 -0
- package/skills/opfs/SKILL.md +138 -0
- package/src/build/index.ts +23 -0
- package/src/build/seam.ts +179 -0
- package/src/core/data-dir-archive.ts +68 -0
- package/src/core/internals.ts +87 -0
- package/src/core/marker.ts +94 -0
- package/src/core/mutex.ts +16 -0
- package/src/core/names.ts +26 -0
- package/src/core/parse.ts +79 -0
- package/src/core/pgwasm.ts +876 -0
- package/src/core/storage.ts +70 -0
- package/src/create.ts +134 -0
- package/src/drizzle/codecs.ts +114 -0
- package/src/drizzle/driver.ts +141 -0
- package/src/drizzle/index.ts +15 -0
- package/src/drizzle/session.ts +133 -0
- package/src/errors.ts +201 -0
- package/src/fs/base-filesystem.ts +149 -0
- package/src/fs/index.ts +7 -0
- package/src/index.ts +44 -0
- package/src/interface.ts +186 -0
- package/src/live/debounce-mutex.ts +45 -0
- package/src/live/format-query.ts +47 -0
- package/src/live/index.ts +707 -0
- package/src/live/interface.ts +109 -0
- package/src/opfs/broker/client.ts +482 -0
- package/src/opfs/broker/protocol.ts +624 -0
- package/src/opfs/broker/server.ts +522 -0
- package/src/opfs/core/checksum.ts +85 -0
- package/src/opfs/core/codec.ts +1051 -0
- package/src/opfs/core/errors.ts +134 -0
- package/src/opfs/core/limits.ts +68 -0
- package/src/opfs/core/memory-port.ts +459 -0
- package/src/opfs/core/metadata-store.ts +512 -0
- package/src/opfs/core/mounted-vfs.ts +407 -0
- package/src/opfs/core/path.ts +82 -0
- package/src/opfs/core/port.ts +114 -0
- package/src/opfs/core/repacked-vfs.ts +1464 -0
- package/src/opfs/core/state-machine.ts +1699 -0
- package/src/opfs/create.ts +125 -0
- package/src/opfs/file-port.ts +183 -0
- package/src/opfs/index.ts +113 -0
- package/src/opfs/opfs-port.ts +90 -0
- package/src/opfs/opfs-repacked-fs.ts +210 -0
- package/src/opfs/wasi/preview1.ts +1016 -0
- package/src/protocol/index.ts +24 -0
- package/src/protocol/wire/buffer-reader.ts +60 -0
- package/src/protocol/wire/buffer-writer.ts +93 -0
- package/src/protocol/wire/index.ts +15 -0
- package/src/protocol/wire/messages.ts +332 -0
- package/src/protocol/wire/parser.ts +373 -0
- package/src/protocol/wire/serializer.ts +233 -0
- package/src/protocol/wire/string-utils.ts +18 -0
- package/src/protocol/wire/types.ts +12 -0
- package/src/tar/gzip.ts +36 -0
- package/src/tar/tar.ts +253 -0
- package/src/templating.ts +103 -0
- package/src/types.ts +283 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
export type InodeId = bigint;
|
|
2
|
+
export type ExtentId = bigint;
|
|
3
|
+
export type MetadataFile = "a" | "b";
|
|
4
|
+
export declare function otherMetadataFile(file: MetadataFile): MetadataFile;
|
|
5
|
+
interface BaseInode {
|
|
6
|
+
id: InodeId;
|
|
7
|
+
mode: number;
|
|
8
|
+
atimeMs: bigint;
|
|
9
|
+
mtimeMs: bigint;
|
|
10
|
+
ctimeMs: bigint;
|
|
11
|
+
}
|
|
12
|
+
export interface DirectoryInode extends BaseInode {
|
|
13
|
+
kind: "directory";
|
|
14
|
+
children: Map<string, InodeId>;
|
|
15
|
+
}
|
|
16
|
+
export interface FileInode extends BaseInode {
|
|
17
|
+
kind: "file";
|
|
18
|
+
size: bigint;
|
|
19
|
+
extents: ExtentId[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A symbolic link. It owns no extents and no children — the whole entry IS its absolute `target`,
|
|
23
|
+
* which path resolution restarts the walk at. See {@link validateSymlinkTarget} for why relative
|
|
24
|
+
* targets are refused.
|
|
25
|
+
*/
|
|
26
|
+
export interface SymlinkInode extends BaseInode {
|
|
27
|
+
kind: "symlink";
|
|
28
|
+
target: string;
|
|
29
|
+
}
|
|
30
|
+
export type Inode = DirectoryInode | FileInode | SymlinkInode;
|
|
31
|
+
export interface OrphanRecord {
|
|
32
|
+
inodeId: InodeId;
|
|
33
|
+
mode: number;
|
|
34
|
+
atimeMs: bigint;
|
|
35
|
+
mtimeMs: bigint;
|
|
36
|
+
ctimeMs: bigint;
|
|
37
|
+
size: bigint;
|
|
38
|
+
extents: ExtentId[];
|
|
39
|
+
}
|
|
40
|
+
export declare function makeOrphanRecord(inode: FileInode): OrphanRecord;
|
|
41
|
+
export declare class IndexedExtentSet {
|
|
42
|
+
#private;
|
|
43
|
+
get size(): number;
|
|
44
|
+
has(extentId: ExtentId): boolean;
|
|
45
|
+
add(extentId: ExtentId): void;
|
|
46
|
+
delete(extentId: ExtentId): boolean;
|
|
47
|
+
values(): readonly ExtentId[];
|
|
48
|
+
peekLast(count: number): ExtentId[];
|
|
49
|
+
clone(): IndexedExtentSet;
|
|
50
|
+
}
|
|
51
|
+
export interface AllocatorState {
|
|
52
|
+
totalExtents: bigint;
|
|
53
|
+
ownedBy: Map<ExtentId, InodeId>;
|
|
54
|
+
available: IndexedExtentSet;
|
|
55
|
+
quarantine: Map<ExtentId, bigint | null>;
|
|
56
|
+
}
|
|
57
|
+
export interface VfsState {
|
|
58
|
+
generation: bigint;
|
|
59
|
+
nextInodeId: bigint;
|
|
60
|
+
rootInodeId: bigint;
|
|
61
|
+
extentSize: number;
|
|
62
|
+
activeMetadataFile: MetadataFile;
|
|
63
|
+
retainedGenerations: Record<MetadataFile, bigint | null>;
|
|
64
|
+
basePayloadBytes: number;
|
|
65
|
+
inodes: Map<InodeId, Inode>;
|
|
66
|
+
parentByInode: Map<InodeId, {
|
|
67
|
+
parentId: InodeId;
|
|
68
|
+
name: string;
|
|
69
|
+
}>;
|
|
70
|
+
allocator: AllocatorState;
|
|
71
|
+
}
|
|
72
|
+
export interface CreateDirectoryChoice {
|
|
73
|
+
parentId: InodeId;
|
|
74
|
+
name: string;
|
|
75
|
+
inodeId: InodeId;
|
|
76
|
+
mode: number;
|
|
77
|
+
atimeMs: bigint;
|
|
78
|
+
mtimeMs: bigint;
|
|
79
|
+
ctimeMs: bigint;
|
|
80
|
+
}
|
|
81
|
+
export interface ExtentRun {
|
|
82
|
+
start: ExtentId;
|
|
83
|
+
count: number;
|
|
84
|
+
}
|
|
85
|
+
export type TxnRecord = {
|
|
86
|
+
kind: "createDirectories";
|
|
87
|
+
entries: readonly CreateDirectoryChoice[];
|
|
88
|
+
} | {
|
|
89
|
+
kind: "createFile";
|
|
90
|
+
parentId: InodeId;
|
|
91
|
+
name: string;
|
|
92
|
+
inodeId: InodeId;
|
|
93
|
+
mode: number;
|
|
94
|
+
atimeMs: bigint;
|
|
95
|
+
mtimeMs: bigint;
|
|
96
|
+
ctimeMs: bigint;
|
|
97
|
+
size: bigint;
|
|
98
|
+
extents: readonly ExtentRun[];
|
|
99
|
+
} | {
|
|
100
|
+
kind: "removeFile";
|
|
101
|
+
parentId: InodeId;
|
|
102
|
+
name: string;
|
|
103
|
+
parentMtimeMs: bigint;
|
|
104
|
+
parentCtimeMs: bigint;
|
|
105
|
+
} | {
|
|
106
|
+
kind: "changeMode";
|
|
107
|
+
inodeId: InodeId;
|
|
108
|
+
mode: number;
|
|
109
|
+
ctimeMs: bigint;
|
|
110
|
+
} | {
|
|
111
|
+
kind: "changeTimes";
|
|
112
|
+
inodeId: InodeId;
|
|
113
|
+
atimeMs: bigint;
|
|
114
|
+
mtimeMs: bigint;
|
|
115
|
+
ctimeMs: bigint;
|
|
116
|
+
} | {
|
|
117
|
+
kind: "resizeFile";
|
|
118
|
+
operation: "truncate" | "write";
|
|
119
|
+
inodeId: InodeId;
|
|
120
|
+
size: bigint;
|
|
121
|
+
allocated: readonly ExtentRun[];
|
|
122
|
+
mtimeMs: bigint;
|
|
123
|
+
ctimeMs: bigint;
|
|
124
|
+
} | {
|
|
125
|
+
kind: "removeDirectory";
|
|
126
|
+
parentId: InodeId;
|
|
127
|
+
name: string;
|
|
128
|
+
parentMtimeMs: bigint;
|
|
129
|
+
parentCtimeMs: bigint;
|
|
130
|
+
} | {
|
|
131
|
+
kind: "rename";
|
|
132
|
+
sourceParentId: InodeId;
|
|
133
|
+
sourceName: string;
|
|
134
|
+
destinationParentId: InodeId;
|
|
135
|
+
destinationName: string;
|
|
136
|
+
timestampMs: bigint;
|
|
137
|
+
} | {
|
|
138
|
+
kind: "createSymlink";
|
|
139
|
+
parentId: InodeId;
|
|
140
|
+
name: string;
|
|
141
|
+
inodeId: InodeId;
|
|
142
|
+
mode: number;
|
|
143
|
+
atimeMs: bigint;
|
|
144
|
+
mtimeMs: bigint;
|
|
145
|
+
ctimeMs: bigint;
|
|
146
|
+
target: string;
|
|
147
|
+
} | {
|
|
148
|
+
kind: "reserveQuarantine";
|
|
149
|
+
extents: readonly ExtentRun[];
|
|
150
|
+
};
|
|
151
|
+
export interface TxnPlan<RecordType extends TxnRecord = TxnRecord> {
|
|
152
|
+
record: RecordType;
|
|
153
|
+
}
|
|
154
|
+
export interface PreflightLimits {
|
|
155
|
+
maxFramePayloadBytes: number;
|
|
156
|
+
maxBasePayloadBytes: number;
|
|
157
|
+
}
|
|
158
|
+
/** The mode a symbolic link carries: `S_IFLNK | 0777`, the only mode POSIX gives a link. */
|
|
159
|
+
export declare const SYMLINK_MODE = 41471;
|
|
160
|
+
export declare function estimateMetadataBasePayloadBytes(state: VfsState): number;
|
|
161
|
+
export declare function estimateTxnPayloadBytes(record: TxnRecord): number;
|
|
162
|
+
export declare function preflightTxn(state: VfsState, record: TxnRecord, limits?: PreflightLimits): number;
|
|
163
|
+
declare const PREPARED_TXN_PROJECTION: unique symbol;
|
|
164
|
+
export interface PreparedTxnProjection {
|
|
165
|
+
readonly projectedBasePayloadBytes: number;
|
|
166
|
+
readonly state: VfsState;
|
|
167
|
+
readonly record: TxnRecord;
|
|
168
|
+
readonly [PREPARED_TXN_PROJECTION]: true;
|
|
169
|
+
}
|
|
170
|
+
/** @internal Bind one projected size to the exact live state and record it preflighted. */
|
|
171
|
+
export declare function prepareTxnProjection(state: VfsState, record: TxnRecord): PreparedTxnProjection;
|
|
172
|
+
export declare function createInitialState(extentSize: number): VfsState;
|
|
173
|
+
export declare function toExtentRuns(extents: readonly ExtentId[]): ExtentRun[];
|
|
174
|
+
export declare function expandExtentRuns(runs: readonly ExtentRun[], maximum: number): ExtentId[];
|
|
175
|
+
export declare function getInodeAtPath(state: VfsState, path: string): Inode;
|
|
176
|
+
/**
|
|
177
|
+
* Resolve every symbolic link on `path` and report the link-free absolute path it names.
|
|
178
|
+
*
|
|
179
|
+
* `follow` governs the FINAL component only — the POSIX `stat`/`lstat` split. Every INTERMEDIATE
|
|
180
|
+
* link is always followed, because a path can only continue through the thing a link points at.
|
|
181
|
+
*
|
|
182
|
+
* A component that does not exist, or one whose parent turned out not to be a directory, stops the
|
|
183
|
+
* walk and the remainder is carried through verbatim: resolution answers "which path does this
|
|
184
|
+
* name", not "does it exist". The operation that follows reports `ENOENT`/`ENOTDIR` itself, or
|
|
185
|
+
* creates the tail — which is exactly what an `open(O_CREAT)` through a symlinked directory needs.
|
|
186
|
+
*
|
|
187
|
+
* Targets are absolute, so a hop restarts the walk at the root. `MAX_SYMLINK_HOPS` hops is `ELOOP`,
|
|
188
|
+
* and each expansion is re-validated by `parsePath`, so a chain that outgrows the store's depth or
|
|
189
|
+
* byte limits is rejected here rather than in a planner.
|
|
190
|
+
*/
|
|
191
|
+
export declare function resolveLinks(state: VfsState, path: string, follow: boolean): string;
|
|
192
|
+
export declare function planMkdir(state: VfsState, path: string, options: {
|
|
193
|
+
recursive?: boolean;
|
|
194
|
+
mode?: number;
|
|
195
|
+
nowMs: bigint;
|
|
196
|
+
}): TxnPlan<Extract<TxnRecord, {
|
|
197
|
+
kind: "createDirectories";
|
|
198
|
+
}>>;
|
|
199
|
+
export declare function planCreateFile(state: VfsState, path: string, options: {
|
|
200
|
+
mode?: number;
|
|
201
|
+
nowMs: bigint;
|
|
202
|
+
size?: bigint;
|
|
203
|
+
}): TxnPlan<Extract<TxnRecord, {
|
|
204
|
+
kind: "createFile";
|
|
205
|
+
}>>;
|
|
206
|
+
/** A symbolic link. Nothing about the TARGET is consulted — the link entry is the whole record. */
|
|
207
|
+
export declare function planSymlink(state: VfsState, path: string, target: string, options: {
|
|
208
|
+
mode?: number;
|
|
209
|
+
nowMs: bigint;
|
|
210
|
+
}): TxnPlan<Extract<TxnRecord, {
|
|
211
|
+
kind: "createSymlink";
|
|
212
|
+
}>>;
|
|
213
|
+
/** Removes a FILE or a SYMBOLIC LINK. A link is unlinked as itself; its target is never touched. */
|
|
214
|
+
export declare function planUnlink(state: VfsState, path: string, nowMs: bigint): TxnPlan<Extract<TxnRecord, {
|
|
215
|
+
kind: "removeFile";
|
|
216
|
+
}>>;
|
|
217
|
+
export declare function planChmod(state: VfsState, path: string, mode: number, nowMs: bigint): TxnPlan<Extract<TxnRecord, {
|
|
218
|
+
kind: "changeMode";
|
|
219
|
+
}>>;
|
|
220
|
+
export declare function planUtimes(state: VfsState, path: string, atimeMs: bigint, mtimeMs: bigint, ctimeMs: bigint): TxnPlan<Extract<TxnRecord, {
|
|
221
|
+
kind: "changeTimes";
|
|
222
|
+
}>>;
|
|
223
|
+
export declare function planResizeFile(state: VfsState, path: string, size: bigint, nowMs: bigint, operation: "truncate" | "write"): TxnPlan<Extract<TxnRecord, {
|
|
224
|
+
kind: "resizeFile";
|
|
225
|
+
}>>;
|
|
226
|
+
/** @internal Inode-first planner for descriptor operations that already resolved the file. */
|
|
227
|
+
export declare function planResizeFileForInode(state: VfsState, inode: FileInode, size: bigint, nowMs: bigint, operation: "truncate" | "write"): TxnPlan<Extract<TxnRecord, {
|
|
228
|
+
kind: "resizeFile";
|
|
229
|
+
}>>;
|
|
230
|
+
export declare function planRmdir(state: VfsState, path: string, nowMs: bigint): TxnPlan<Extract<TxnRecord, {
|
|
231
|
+
kind: "removeDirectory";
|
|
232
|
+
}>>;
|
|
233
|
+
export declare function planRename(state: VfsState, oldPath: string, newPath: string, nowMs: bigint): TxnPlan<Extract<TxnRecord, {
|
|
234
|
+
kind: "rename";
|
|
235
|
+
}>>;
|
|
236
|
+
export declare function planReserveQuarantine(state: VfsState, count: number): TxnPlan<Extract<TxnRecord, {
|
|
237
|
+
kind: "reserveQuarantine";
|
|
238
|
+
}>>;
|
|
239
|
+
export declare function applyTxn(state: VfsState, record: TxnRecord, prepared?: PreparedTxnProjection): void;
|
|
240
|
+
export declare function projectRepack(state: VfsState, pinnedQuarantine?: ReadonlySet<ExtentId>): VfsState;
|
|
241
|
+
/**
|
|
242
|
+
* @internal Activation-only projection. Structures repack never mutates are shared read-only until
|
|
243
|
+
* durable activation; allocator and generation structures remain isolated from the live state.
|
|
244
|
+
*/
|
|
245
|
+
export declare function projectRepackForActivation(state: VfsState, pinnedQuarantine?: ReadonlySet<ExtentId>): VfsState;
|
|
246
|
+
export declare function validateState(state: VfsState): void;
|
|
247
|
+
export declare function canonicalStateView(state: VfsState): {
|
|
248
|
+
generation: bigint;
|
|
249
|
+
nextInodeId: bigint;
|
|
250
|
+
rootInodeId: bigint;
|
|
251
|
+
extentSize: number;
|
|
252
|
+
activeMetadataFile: MetadataFile;
|
|
253
|
+
retainedGenerations: {
|
|
254
|
+
a: bigint | null;
|
|
255
|
+
b: bigint | null;
|
|
256
|
+
};
|
|
257
|
+
basePayloadBytes: number;
|
|
258
|
+
inodes: ({
|
|
259
|
+
id: InodeId;
|
|
260
|
+
mode: number;
|
|
261
|
+
atimeMs: bigint;
|
|
262
|
+
mtimeMs: bigint;
|
|
263
|
+
ctimeMs: bigint;
|
|
264
|
+
kind: "directory";
|
|
265
|
+
children: [string, bigint][];
|
|
266
|
+
} | {
|
|
267
|
+
id: InodeId;
|
|
268
|
+
mode: number;
|
|
269
|
+
atimeMs: bigint;
|
|
270
|
+
mtimeMs: bigint;
|
|
271
|
+
ctimeMs: bigint;
|
|
272
|
+
kind: "file";
|
|
273
|
+
size: bigint;
|
|
274
|
+
extents: bigint[];
|
|
275
|
+
} | {
|
|
276
|
+
id: InodeId;
|
|
277
|
+
mode: number;
|
|
278
|
+
atimeMs: bigint;
|
|
279
|
+
mtimeMs: bigint;
|
|
280
|
+
ctimeMs: bigint;
|
|
281
|
+
kind: "symlink";
|
|
282
|
+
target: string;
|
|
283
|
+
})[];
|
|
284
|
+
parentByInode: [bigint, {
|
|
285
|
+
parentId: InodeId;
|
|
286
|
+
name: string;
|
|
287
|
+
}][];
|
|
288
|
+
allocator: {
|
|
289
|
+
totalExtents: bigint;
|
|
290
|
+
ownedBy: [bigint, bigint][];
|
|
291
|
+
available: bigint[];
|
|
292
|
+
quarantine: [bigint, bigint | null][];
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
export {};
|
|
296
|
+
//# sourceMappingURL=state-machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-machine.d.ts","sourceRoot":"","sources":["../../../src/opfs/core/state-machine.ts"],"names":[],"mappings":"AAiBA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MA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AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,QAAQ,EACf,gBAAgB,GAAE,WAAW,CAAC,QAAQ,CAAa,GAClD,QAAQ,CAcV;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CA2InD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ;;;;;;;;;;;;YAxmD5C,OAAO;cACL,MAAM;iBACH,MAAM;iBACN,MAAM;iBACN,MAAM;cAIT,WAAW;;;YARb,OAAO;cACL,MAAM;iBACH,MAAM;iBACN,MAAM;iBACN,MAAM;cAST,MAAM;cACN,MAAM;;;YAdR,OAAO;cACL,MAAM;iBACH,MAAM;iBACN,MAAM;iBACN,MAAM;cAoBT,SAAS;gBACP,MAAM;;;kBAiG0B,OAAO;cAAQ,MAAM;;;QAwgDzD,YAAY;QACZ,OAAO;QACP,SAAS;QACT,UAAU;;EAGf"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PostgresBuild } from "../build/seam";
|
|
2
|
+
import type { Extensions, Pgwasm, PgwasmOptions, PgwasmWithExtensions } from "../interface";
|
|
3
|
+
import type { OpfsDirectoryHandle } from "./opfs-port";
|
|
4
|
+
import type { RepackedFilesystemOptions } from "./opfs-repacked-fs";
|
|
5
|
+
/** The database options `createOpfsPgwasm` passes through: all but the ones the store owns. */
|
|
6
|
+
export type OpfsPgwasmHostOptions<E extends Extensions = Record<never, never>> = Omit<PgwasmOptions<E>, "build" | "dataDir" | "fs" | "relaxedDurability">;
|
|
7
|
+
export interface CreateOpfsPgwasmOptions<E extends Extensions = Record<never, never>> extends RepackedFilesystemOptions {
|
|
8
|
+
/** The Postgres build to run, e.g. `cBuild` from `@pgxsinkit/pgwasm-c`. */
|
|
9
|
+
readonly build: PostgresBuild;
|
|
10
|
+
/** Dedicated directory owned in full by this store. */
|
|
11
|
+
readonly directory: OpfsDirectoryHandle;
|
|
12
|
+
/** Database options other than the store-owned `build`, `dataDir`, `fs` and `relaxedDurability`. */
|
|
13
|
+
readonly pgwasm?: OpfsPgwasmHostOptions<E>;
|
|
14
|
+
/**
|
|
15
|
+
* Optional progress callback for the two long, otherwise-invisible steps of an OPFS-repacked create.
|
|
16
|
+
* Called once per phase, in order, and only on the success path:
|
|
17
|
+
*
|
|
18
|
+
* - `"store-opened"` — the store's sync access handles are acquired and the repacked filesystem is open.
|
|
19
|
+
* Everything before this is handle acquisition, which is where a create that never returns stalls.
|
|
20
|
+
* - `"pgwasm-ready"` — the database's own boot (WASM instantiation, initdb or catalog open) has completed.
|
|
21
|
+
*
|
|
22
|
+
* Diagnosability only: it carries no policy, must not throw, and a create's outcome never depends on it.
|
|
23
|
+
* The host uses it to stamp a boot rail, so a stalled create is attributable to a phase rather than
|
|
24
|
+
* silent.
|
|
25
|
+
*/
|
|
26
|
+
readonly onPhase?: (phase: OpfsCreatePhase) => void;
|
|
27
|
+
}
|
|
28
|
+
/** The create phases {@link CreateOpfsPgwasmOptions.onPhase} reports, in the order they occur. */
|
|
29
|
+
export type OpfsCreatePhase = "store-opened" | "pgwasm-ready";
|
|
30
|
+
/**
|
|
31
|
+
* A database on an OPFS-repacked store: a plain pgwasm database. Its one strict operation, reserved for
|
|
32
|
+
* the sync layer above the store, is {@link strictSync}.
|
|
33
|
+
*/
|
|
34
|
+
export type OpfsPgwasm<E extends Extensions = Record<never, never>> = PgwasmWithExtensions<E>;
|
|
35
|
+
/**
|
|
36
|
+
* Construct the only supported OPFS-repacked/pgwasm pairing.
|
|
37
|
+
*
|
|
38
|
+
* pgwasm always awaits the filesystem sync (`relaxedDurability: false`). Physical durability is selected
|
|
39
|
+
* once, here, by the store's `durability` option and is never delegated to the database option. A
|
|
40
|
+
* strict sync completes successful database initialization before return. Closing the database closes
|
|
41
|
+
* the store: its build releases the filesystem (`closeFs`) on every close, a failed one included.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createOpfsPgwasm<E extends Extensions = Record<never, never>>(options: CreateOpfsPgwasmOptions<E>): Promise<OpfsPgwasm<E>>;
|
|
44
|
+
/**
|
|
45
|
+
* Stabilize every preceding data and metadata operation of a database on an OPFS-repacked store, in
|
|
46
|
+
* strict order, serialized against its queries. Throws {@link UnsupportedFeatureError} for a database
|
|
47
|
+
* that `createOpfsPgwasm` did not create.
|
|
48
|
+
*/
|
|
49
|
+
export declare function strictSync(pg: Pgwasm): Promise<void>;
|
|
50
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/opfs/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEpE,+FAA+F;AAC/F,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,CACnF,aAAa,CAAC,CAAC,CAAC,EAChB,OAAO,GAAG,SAAS,GAAG,IAAI,GAAG,mBAAmB,CACjD,CAAC;AAEF,MAAM,WAAW,uBAAuB,CACtC,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAC3C,SAAQ,yBAAyB;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,oGAAoG;IACpG,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC3C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CACrD;AAED,kGAAkG;AAClG,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,cAAc,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAE9F;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAChF,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAgCxB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAU1D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OwnedFileName, RepackedFileHandle, RepackedPort, RepackedPortEntry } from "./core/port";
|
|
2
|
+
export declare class FileRepackedPort implements RepackedPort {
|
|
3
|
+
#private;
|
|
4
|
+
/**
|
|
5
|
+
* @param directory The directory this store owns in full. It is created on first use, with every
|
|
6
|
+
* parent, exactly as the OPFS port's caller creates its directory handle with `create: true`.
|
|
7
|
+
*/
|
|
8
|
+
constructor(directory: string);
|
|
9
|
+
/** The directory this port reads and writes. Absolute or relative, exactly as it was given. */
|
|
10
|
+
get directory(): string;
|
|
11
|
+
enumerate(_label: string): Promise<readonly RepackedPortEntry[]>;
|
|
12
|
+
acquire(name: OwnedFileName, _label: string): Promise<RepackedFileHandle>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=file-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-port.d.ts","sourceRoot":"","sources":["../../src/opfs/file-port.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAyCtG,qBAAa,gBAAiB,YAAW,YAAY;;IAKnD;;;OAGG;IACH,YAAY,SAAS,EAAE,MAAM,EAG5B;IAED,+FAA+F;IAC/F,IAAI,SAAS,IAAI,MAAM,CAEtB;IAEK,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CASrE;IAEK,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAc9E;CAUF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { CorruptStoreError, DurabilityModeMismatchError, ExtentSizeMismatchError, FsError, StoreClosedError, StoreFailedError, StoreLimitError, StoreOwnedError, StoreRecreationRequiredError, UnexpectedStoreEntryError, } from "./core/errors";
|
|
2
|
+
export { createOpfsPgwasm, strictSync, type CreateOpfsPgwasmOptions, type OpfsCreatePhase, type OpfsPgwasm, type OpfsPgwasmHostOptions, } from "./create";
|
|
3
|
+
export { OpfsRepackedFS, type RepackedDurability } from "./opfs-repacked-fs";
|
|
4
|
+
export { RepackedVfs, type RepackedFileSystem, type RepackedStat, type RepackedVfsMetrics, type RepackedVfsOpenOptions, } from "./core/repacked-vfs";
|
|
5
|
+
export { MemoryRepackedPort, type MemoryFault, type MemoryOperation } from "./core/memory-port";
|
|
6
|
+
/**
|
|
7
|
+
* Several stores as ONE tree, joined at path prefixes: a durable OPFS root with a memory-backed
|
|
8
|
+
* mount at a chosen prefix, handed to the broker as a single store. Which prefix, which port, and
|
|
9
|
+
* whether a mount is durable are the STORAGE OWNER's declarations — nothing is inferred.
|
|
10
|
+
*/
|
|
11
|
+
export { MountedRepackedVfs, type MountedRepackedVfsOptions, type RepackedMount } from "./core/mounted-vfs";
|
|
12
|
+
export type { RepackedFileHandle, RepackedPort, RepackedPortEntry } from "./core/port";
|
|
13
|
+
/**
|
|
14
|
+
* The OPFS-backed port for that same store core: four `FileSystemSyncAccessHandle`s over one dedicated
|
|
15
|
+
* OPFS directory. `createOpfsPgwasm` builds this internally, so a pgwasm consumer never needs
|
|
16
|
+
* it; it is exported for a host that owns the store itself — a coordinator worker serving the sync
|
|
17
|
+
* broker to a wasm engine — and wants that store persisted rather than in memory. It must be
|
|
18
|
+
* constructed in a scope where `createSyncAccessHandle()` actually SUCCEEDS (a dedicated worker in
|
|
19
|
+
* every engine, plus a SharedWorker on real Safari); method presence is not proof, the window main
|
|
20
|
+
* thread is never such a scope, and a denial surfaces as an open failure rather than a fallback.
|
|
21
|
+
* `OpfsDirectoryHandle` is the structural slice of `FileSystemDirectoryHandle` the port actually uses,
|
|
22
|
+
* so a real handle satisfies it without a cast.
|
|
23
|
+
*/
|
|
24
|
+
export { OpfsRepackedPort, type OpfsDirectoryHandle } from "./opfs-port";
|
|
25
|
+
/**
|
|
26
|
+
* The same store's four files in an ordinary DIRECTORY, over `node:fs`. The port a build step uses:
|
|
27
|
+
* a host under Node or Bun fills a store where the bytes are ordinary files, ships those four files,
|
|
28
|
+
* and a browser's `OpfsRepackedPort` opens them as the same store — the format lives above the port,
|
|
29
|
+
* so neither side learns which one it is on. `node:fs` is imported lazily so the browser bundle can
|
|
30
|
+
* carry this module without a static `node:` import being compiled to nothing (see `./file-port`).
|
|
31
|
+
*/
|
|
32
|
+
export { FileRepackedPort } from "./file-port";
|
|
33
|
+
export { RepackedSyncBroker, type RepackedSyncBrokerOptions } from "./broker/server";
|
|
34
|
+
export { RepackedBrokerStoreError, RepackedBrokerTransportError, RepackedSyncClient, throwOnErrno, type BrokerCountResult, type BrokerOpenResult, type BrokerReadResult, type BrokerReaddirPageResult, type BrokerReaddirResult, type BrokerReadlinkResult, type BrokerResult, type BrokerSizeResult, type BrokerStatResult, type RepackedSyncClientOptions, } from "./broker/client";
|
|
35
|
+
export { DEFAULT_PAYLOAD_BYTES, O_APPEND, O_CREAT, O_EXCL, O_NOFOLLOW, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, RepackedChannel, RepackedDoorbell, errnoName, fsErrorNameOf, planOpen, type BrokerStat, type OpenPlan, type RepackedChannelTransfer, } from "./broker/protocol";
|
|
36
|
+
export { WASI_ERRNO, WASI_FILETYPE, createWasiPreview1Fs, normalizeWasiPath, type WasiPreview1Fs, type WasiPreview1FsFunctions, type WasiPreview1FsOptions, } from "./wasi/preview1";
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/opfs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,uBAAuB,EACvB,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,qBAAqB,GAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAI7E,OAAO,EACL,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhG;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5G,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEvF;;;;;;;;;;GAUG;AACH,OAAO,EA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