@amalgm/shell 0.1.164-main.41474889901 → 0.1.164-main.41526666971
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/dist/cli.js +34 -41
- package/dist/cli.js.map +1 -1
- package/dist/drive/fuse.d.ts +13 -116
- package/dist/drive/fuse.js +36 -145
- package/dist/drive/fuse.js.map +1 -1
- package/dist/drive/kernel.d.ts +17 -0
- package/dist/drive/kernel.js +32 -0
- package/dist/drive/kernel.js.map +1 -0
- package/dist/drive/layout.d.ts +2 -0
- package/dist/drive/layout.js +8 -4
- package/dist/drive/layout.js.map +1 -1
- package/dist/drive/mount.d.ts +16 -6
- package/dist/drive/mount.js +50 -24
- package/dist/drive/mount.js.map +1 -1
- package/dist/drive/mountpoint.d.ts +14 -0
- package/dist/drive/mountpoint.js +51 -0
- package/dist/drive/mountpoint.js.map +1 -0
- package/dist/drive/nfs/apple-double.d.ts +6 -0
- package/dist/drive/nfs/apple-double.js +140 -0
- package/dist/drive/nfs/apple-double.js.map +1 -0
- package/dist/drive/nfs/attributes.d.ts +64 -0
- package/dist/drive/nfs/attributes.js +97 -0
- package/dist/drive/nfs/attributes.js.map +1 -0
- package/dist/drive/nfs/handles.d.ts +44 -0
- package/dist/drive/nfs/handles.js +209 -0
- package/dist/drive/nfs/handles.js.map +1 -0
- package/dist/drive/nfs/mount3.d.ts +16 -0
- package/dist/drive/nfs/mount3.js +38 -0
- package/dist/drive/nfs/mount3.js.map +1 -0
- package/dist/drive/nfs/nfs3.d.ts +27 -0
- package/dist/drive/nfs/nfs3.js +458 -0
- package/dist/drive/nfs/nfs3.js.map +1 -0
- package/dist/drive/nfs/rpc.d.ts +66 -0
- package/dist/drive/nfs/rpc.js +122 -0
- package/dist/drive/nfs/rpc.js.map +1 -0
- package/dist/drive/nfs/server.d.ts +30 -0
- package/dist/drive/nfs/server.js +109 -0
- package/dist/drive/nfs/server.js.map +1 -0
- package/dist/drive/nfs/xdr.d.ts +44 -0
- package/dist/drive/nfs/xdr.js +111 -0
- package/dist/drive/nfs/xdr.js.map +1 -0
- package/dist/drive/nfs.d.ts +60 -0
- package/dist/drive/nfs.js +181 -0
- package/dist/drive/nfs.js.map +1 -0
- package/dist/drive/operations.d.ts +125 -0
- package/dist/drive/operations.js +141 -0
- package/dist/drive/operations.js.map +1 -0
- package/dist/error-facts.d.ts +24 -0
- package/dist/error-facts.js +35 -0
- package/dist/error-facts.js.map +1 -0
- package/dist/files-program/client.d.ts +122 -0
- package/dist/files-program/client.js +430 -0
- package/dist/files-program/client.js.map +1 -0
- package/dist/files-program/journeys.d.ts +15 -0
- package/dist/files-program/journeys.js +79 -0
- package/dist/files-program/journeys.js.map +1 -0
- package/dist/files-program/program.d.ts +1 -0
- package/dist/files-program/program.js +255 -0
- package/dist/files-program/program.js.map +1 -0
- package/dist/files-program/protocol.d.ts +154 -0
- package/dist/files-program/protocol.js +7 -0
- package/dist/files-program/protocol.js.map +1 -0
- package/dist/machine-host.d.ts +35 -32
- package/dist/machine-host.js +124 -195
- package/dist/machine-host.js.map +1 -1
- package/dist/runtime-node-flags.d.ts +6 -6
- package/dist/runtime-node-flags.js +6 -6
- package/dist/sharing-host.d.ts +6 -11
- package/dist/sharing-host.js +6 -10
- package/dist/sharing-host.js.map +1 -1
- package/dist/sync-cli.js +1 -1
- package/dist/sync-cli.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The drive as an NFS version 3 server on the loopback address, mounted by
|
|
3
|
+
* macOS's own NFS client (`mount_nfs`): nothing to install, no kernel
|
|
4
|
+
* extension, and an ordinary user mounts it. Each NFS procedure is answered
|
|
5
|
+
* by the drive's operations (operations.ts) through nfs/nfs3.ts; this file
|
|
6
|
+
* stands the server and the mount.
|
|
7
|
+
*
|
|
8
|
+
* Who may call. A loopback port is open to every program on the computer,
|
|
9
|
+
* and AUTH_SYS names whatever user a caller claims, so neither proves the
|
|
10
|
+
* caller is the kernel. What does: every file is named by a handle the
|
|
11
|
+
* server hands out, and a handle carries a MAC under a secret only this
|
|
12
|
+
* person can read (nfs/handles.ts), so a caller holds a handle only if the
|
|
13
|
+
* server gave it one. The root's handle is handed out only by MOUNT, and
|
|
14
|
+
* MOUNT answers only while this program runs `mount_nfs`, for an export path
|
|
15
|
+
* drawn afresh for that mount. The kernel then calls as the user each
|
|
16
|
+
* program runs as: the person's own calls, and root's, are served as the
|
|
17
|
+
* person; any other user's are refused.
|
|
18
|
+
*
|
|
19
|
+
* A Mac keeps a file's extended attributes on NFS in a `._` file beside it;
|
|
20
|
+
* those stay on this computer, in `state` (nfs/apple-double.ts).
|
|
21
|
+
*
|
|
22
|
+
* The folder the drive mounts on is locked before it is first mounted
|
|
23
|
+
* (mountpoint.ts), so a write while no mount stands there, once the runtime
|
|
24
|
+
* stopped or between forcing a mount off and mounting afresh, is refused.
|
|
25
|
+
*
|
|
26
|
+
* A mount outlives the program serving it. When the Files program stops, the
|
|
27
|
+
* mount stays and the kernel waits (`hard`): a program reading it waits too,
|
|
28
|
+
* never sees an empty folder, and can be interrupted (`intr`). The next Files
|
|
29
|
+
* program finds the mount in the mount table, never by looking at the
|
|
30
|
+
* folder, since a look at a mount with no server waits for one, and serves
|
|
31
|
+
* it again on the same port with the same handles, kept in `state`.
|
|
32
|
+
*/
|
|
33
|
+
import { execFile } from "node:child_process";
|
|
34
|
+
import { randomBytes } from "node:crypto";
|
|
35
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
36
|
+
import { basename, dirname, join } from "node:path";
|
|
37
|
+
import { promisify } from "node:util";
|
|
38
|
+
import { folderLock, standMountpoint } from "./mountpoint.js";
|
|
39
|
+
import { appleDoubleKeptHere } from "./nfs/apple-double.js";
|
|
40
|
+
import { Handles } from "./nfs/handles.js";
|
|
41
|
+
import { mountProgram } from "./nfs/mount3.js";
|
|
42
|
+
import { nfsProgram, TRANSFER_MAX } from "./nfs/nfs3.js";
|
|
43
|
+
import { serveRpc } from "./nfs/server.js";
|
|
44
|
+
import { driveOperations, resting } from "./operations.js";
|
|
45
|
+
const execFileAsync = promisify(execFile);
|
|
46
|
+
const AUTH_SYS = 1;
|
|
47
|
+
/** The client's options besides where the server listens: TCP, waiting for
|
|
48
|
+
* a server that stopped rather than failing (`hard`, `intr`), locks kept on
|
|
49
|
+
* this computer (there is no lock server), no cache of missing names, so a
|
|
50
|
+
* file another computer adds shows at once, attributes cached one second,
|
|
51
|
+
* whole-megabyte transfers, plain READDIR listings, and no volume icon: the
|
|
52
|
+
* drive is the person's home folder, not a disk.
|
|
53
|
+
*
|
|
54
|
+
* Listings are plain READDIR, never READDIRPLUS, the Mac's default. With
|
|
55
|
+
* READDIRPLUS the Mac answers a `._` name from a folder listing it holds
|
|
56
|
+
* whole, never asking the server, as missing even when it is creating that
|
|
57
|
+
* name; so a file's first extended attribute in a folder already listed is
|
|
58
|
+
* refused until the folder changes. */
|
|
59
|
+
export const MOUNT_OPTIONS = [
|
|
60
|
+
"vers=3", "tcp", "hard", "intr", "locallocks", "nonegnamecache", "actimeo=1", "nordirplus",
|
|
61
|
+
`rsize=${TRANSFER_MAX}`, `wsize=${TRANSFER_MAX}`, "dsize=65536", "nobrowse",
|
|
62
|
+
];
|
|
63
|
+
/** Serves the drive at `mountpoint` through macOS's NFS client. Resolves once
|
|
64
|
+
* the kernel serves it; it stays mounted until `unmount()`, which is for the
|
|
65
|
+
* whole runtime's stop. */
|
|
66
|
+
export async function mountNfs(input) {
|
|
67
|
+
mkdirSync(input.state, { recursive: true, mode: 0o700 });
|
|
68
|
+
const portFile = join(input.state, "port");
|
|
69
|
+
const handlesFile = join(input.state, "handles");
|
|
70
|
+
// A standing mount is served again only with the handles it was handed and
|
|
71
|
+
// the port it calls; without them it is unmounted and mounted afresh.
|
|
72
|
+
const keptPort = input.standing && existsSync(handlesFile) ? readPort(portFile) : null;
|
|
73
|
+
if (input.standing && keptPort === null)
|
|
74
|
+
await umount(input.mountpoint, true);
|
|
75
|
+
const handles = Handles.open(handlesFile);
|
|
76
|
+
const owned = new Set();
|
|
77
|
+
const mounted = new Date();
|
|
78
|
+
const uid = input.uid ?? process.getuid?.() ?? 0;
|
|
79
|
+
const gid = input.gid ?? process.getgid?.() ?? 0;
|
|
80
|
+
const sidecars = join(input.state, "apple-double");
|
|
81
|
+
const operations = (drive) => appleDoubleKeptHere(driveOperations({
|
|
82
|
+
drive: drive.drive, shelf: drive.shelf, home: drive.home, mounted, uid, gid, owned,
|
|
83
|
+
...(drive.onPlaced ? { onPlaced: drive.onPlaced } : {}),
|
|
84
|
+
}), sidecars);
|
|
85
|
+
let serving = operations(input);
|
|
86
|
+
const rest = resting(Object.keys(serving));
|
|
87
|
+
let mounting = null;
|
|
88
|
+
const serve = (port) => driveServer({
|
|
89
|
+
port, handles, operations: () => serving, uid, exportPath: () => mounting,
|
|
90
|
+
...(input.trace ? { trace: input.trace } : {}),
|
|
91
|
+
...(input.onFault ? { onFault: input.onFault } : {}),
|
|
92
|
+
});
|
|
93
|
+
/** A server on a free port, and the kernel's mount of it. */
|
|
94
|
+
const mountFresh = async () => {
|
|
95
|
+
await standMountpoint(input.mountpoint, folderLock("darwin"));
|
|
96
|
+
const server = await serve(0);
|
|
97
|
+
writeFileSync(portFile, `${server.port}\n`, { mode: 0o600 });
|
|
98
|
+
mounting = `/amalgm-${randomBytes(12).toString("hex")}`;
|
|
99
|
+
const options = [...input.options ?? MOUNT_OPTIONS, `port=${server.port}`, `mountport=${server.port}`];
|
|
100
|
+
try {
|
|
101
|
+
await execFileAsync("/sbin/mount_nfs", ["-o", options.join(","), `127.0.0.1:${mounting}`, input.mountpoint]);
|
|
102
|
+
return server;
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
await server.close();
|
|
106
|
+
const reason = error.stderr || (error instanceof Error ? error.message : String(error));
|
|
107
|
+
throw new Error(`mount_nfs could not mount the drive at ${input.mountpoint}: ${String(reason).trim()}`, { cause: error });
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
mounting = null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
// Another program can take the port while no Files program holds it. The
|
|
114
|
+
// standing mount would then call that program, so it is unmounted and the
|
|
115
|
+
// drive mounted afresh: a mount is only ever served by the person's drive.
|
|
116
|
+
const kept = keptPort === null ? null : await serve(keptPort).catch((error) => {
|
|
117
|
+
if (error.code === "EADDRINUSE")
|
|
118
|
+
return null;
|
|
119
|
+
throw error;
|
|
120
|
+
});
|
|
121
|
+
if (keptPort !== null && kept === null)
|
|
122
|
+
await umount(input.mountpoint, true);
|
|
123
|
+
const server = kept ?? await mountFresh();
|
|
124
|
+
return {
|
|
125
|
+
serve: (drive) => { serving = operations(drive); },
|
|
126
|
+
rest: () => { serving = rest; },
|
|
127
|
+
unmount: async () => {
|
|
128
|
+
// The server answers until the kernel lets go: unmounting calls it.
|
|
129
|
+
await umount(input.mountpoint, false);
|
|
130
|
+
await server.close();
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** The drive's RPC server: MOUNT, which hands out the root's handle, and
|
|
135
|
+
* NFS, which answers each procedure by the drive's operations, over one
|
|
136
|
+
* table of handles. It serves AUTH_SYS calls as the person or as root, as
|
|
137
|
+
* the kernel calls for programs root runs; any other user, and a call that
|
|
138
|
+
* names no user, is refused. */
|
|
139
|
+
export function driveServer(input) {
|
|
140
|
+
const admits = (credential) => credential.flavor === AUTH_SYS && (credential.uid === input.uid || credential.uid === 0);
|
|
141
|
+
return serveRpc({
|
|
142
|
+
port: input.port,
|
|
143
|
+
max: TRANSFER_MAX + (1 << 16),
|
|
144
|
+
programs: [
|
|
145
|
+
mountProgram({ exportPath: input.exportPath, root: input.handles.handle(input.handles.root) }),
|
|
146
|
+
nfsProgram({
|
|
147
|
+
operations: input.operations, handles: input.handles, verifier: randomBytes(8), admits,
|
|
148
|
+
...(input.trace ? { trace: input.trace } : {}),
|
|
149
|
+
}),
|
|
150
|
+
],
|
|
151
|
+
...(input.onFault ? { onFault: input.onFault } : {}),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/** Whether an NFS mount stands at `mountpoint`, from the mount table. The
|
|
155
|
+
* folder itself is never looked at: with no server answering, a look waits
|
|
156
|
+
* for one. */
|
|
157
|
+
export async function nfsStanding(mountpoint) {
|
|
158
|
+
let parent;
|
|
159
|
+
try {
|
|
160
|
+
parent = realpathSync(dirname(mountpoint));
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
const at = join(parent, basename(mountpoint));
|
|
166
|
+
const { stdout } = await execFileAsync("/sbin/mount", [], { encoding: "utf8" });
|
|
167
|
+
return stdout.split("\n").some((line) => line.includes(` on ${at} (nfs`));
|
|
168
|
+
}
|
|
169
|
+
function readPort(file) {
|
|
170
|
+
try {
|
|
171
|
+
const port = Number(readFileSync(file, "utf8").trim());
|
|
172
|
+
return Number.isInteger(port) && port > 0 && port < 65536 ? port : null;
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async function umount(mountpoint, force) {
|
|
179
|
+
await execFileAsync("/sbin/umount", force ? ["-f", mountpoint] : [mountpoint]);
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=nfs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nfs.js","sourceRoot":"","sources":["../../src/drive/nfs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3F,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
* adapter serves it: FUSE on Linux (fuse.ts), NFS on macOS (nfs/). Every
|
|
4
|
+
* operation is answered by one rule: judge the address with the drive;
|
|
5
|
+
* looking, listing and stat place nothing; any operation that opens,
|
|
6
|
+
* changes, removes, renames or follows an address touches it first, and a
|
|
7
|
+
* creation touches the address it creates at so its ancestors stand; then
|
|
8
|
+
* the operation runs on the shelf's own path, on the shelf of the root the
|
|
9
|
+
* judgment names: the home's, or the root a reference led into. Inside an
|
|
10
|
+
* unplaced repository the map cannot see, so there a stat or a listing
|
|
11
|
+
* places the repository first (the drive's named exception).
|
|
12
|
+
*
|
|
13
|
+
* Unknown stays unknown: a never-placed file's size is reported as 0 because
|
|
14
|
+
* the map carries no sizes, so an adapter asks again after it opens, and
|
|
15
|
+
* reads the real size. A placement that cannot finish is EIO, never ENOENT
|
|
16
|
+
* and never zero bytes.
|
|
17
|
+
*
|
|
18
|
+
* Every operation answers on the main thread of the program that serves the
|
|
19
|
+
* drive, and the kernel waits for the answer. So the shelf's I/O here is
|
|
20
|
+
* synchronous, never through the libuv pool: an operation that waited on
|
|
21
|
+
* that pool could wait behind an in-process read of the mount itself, which
|
|
22
|
+
* waits on this thread. The same fact gives the drive its own program
|
|
23
|
+
* (../files-program/) and the rest of the runtime its rule (README.md): no
|
|
24
|
+
* program goes through the mount it serves; the mount is the door for people
|
|
25
|
+
* and the programs they run.
|
|
26
|
+
*/
|
|
27
|
+
import { type Stats } from "node:fs";
|
|
28
|
+
import type { Drive, Receipt } from "@amalgm/live/drive";
|
|
29
|
+
import type { Shelf } from "./shelf.js";
|
|
30
|
+
/** The kernel's attributes of an address: the shelf's own, or synthesized
|
|
31
|
+
* for a listed entity nobody has touched. */
|
|
32
|
+
export interface Attributes {
|
|
33
|
+
readonly mode: number;
|
|
34
|
+
readonly size: number;
|
|
35
|
+
readonly nlink: number;
|
|
36
|
+
readonly uid: number;
|
|
37
|
+
readonly gid: number;
|
|
38
|
+
readonly atime: Date;
|
|
39
|
+
readonly mtime: Date;
|
|
40
|
+
readonly ctime: Date;
|
|
41
|
+
}
|
|
42
|
+
export interface Statfs {
|
|
43
|
+
readonly bsize: number;
|
|
44
|
+
readonly frsize: number;
|
|
45
|
+
readonly blocks: number;
|
|
46
|
+
readonly bfree: number;
|
|
47
|
+
readonly bavail: number;
|
|
48
|
+
readonly files: number;
|
|
49
|
+
readonly ffree: number;
|
|
50
|
+
readonly favail: number;
|
|
51
|
+
readonly fsid: number;
|
|
52
|
+
readonly flag: number;
|
|
53
|
+
readonly namemax: number;
|
|
54
|
+
}
|
|
55
|
+
/** The filesystem's operations, each a promise because judging and placing
|
|
56
|
+
* an address are. Paths are the kernel's, `/` the drive's root; signatures
|
|
57
|
+
* follow libfuse 2, the callback left off. */
|
|
58
|
+
export interface DriveOperations {
|
|
59
|
+
getattr(path: string): Promise<Attributes | Stats>;
|
|
60
|
+
fgetattr(path: string, fd: number): Promise<Stats>;
|
|
61
|
+
/** The address placed, and its real attributes: for a kernel that opens
|
|
62
|
+
* without saying so (NFS has no OPEN), at its first sign of an open. */
|
|
63
|
+
place(path: string): Promise<Stats>;
|
|
64
|
+
access(path: string, mode: number): Promise<void>;
|
|
65
|
+
readdir(path: string): Promise<string[]>;
|
|
66
|
+
opendir(path: string, flags: number): Promise<number>;
|
|
67
|
+
releasedir(path: string, fd: number): Promise<void>;
|
|
68
|
+
statfs(path: string): Promise<Statfs>;
|
|
69
|
+
open(path: string, flags: number): Promise<number>;
|
|
70
|
+
create(path: string, mode: number): Promise<number>;
|
|
71
|
+
read(path: string, fd: number, buffer: Buffer, length: number, position: number): Promise<number>;
|
|
72
|
+
write(path: string, fd: number, buffer: Buffer, length: number, position: number): Promise<number>;
|
|
73
|
+
release(path: string, fd: number): Promise<void>;
|
|
74
|
+
flush(path: string, fd: number): Promise<void>;
|
|
75
|
+
fsync(path: string, datasync: boolean, fd: number): Promise<void>;
|
|
76
|
+
truncate(path: string, size: number): Promise<void>;
|
|
77
|
+
ftruncate(path: string, fd: number, size: number): Promise<void>;
|
|
78
|
+
utimens(path: string, atime: number, mtime: number): Promise<void>;
|
|
79
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
80
|
+
chown(path: string, uid: number, gid: number): Promise<void>;
|
|
81
|
+
readlink(path: string): Promise<string>;
|
|
82
|
+
unlink(path: string): Promise<void>;
|
|
83
|
+
rmdir(path: string): Promise<void>;
|
|
84
|
+
mkdir(path: string, mode: number): Promise<void>;
|
|
85
|
+
symlink(target: string, path: string): Promise<void>;
|
|
86
|
+
rename(from: string, to: string): Promise<void>;
|
|
87
|
+
link(from: string, to: string): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
export interface DriveOperationsInput {
|
|
90
|
+
readonly drive: Drive;
|
|
91
|
+
/** The shelf of a root the drive has entered: where each judged address's
|
|
92
|
+
* ground stands on this computer. */
|
|
93
|
+
readonly shelf: (rootUUID: string) => Shelf;
|
|
94
|
+
/** The home's root UUID; its shelf is the drive's disk for statfs. */
|
|
95
|
+
readonly home: string;
|
|
96
|
+
readonly uid: number;
|
|
97
|
+
readonly gid: number;
|
|
98
|
+
/** The time every synthesized attribute carries: when the drive mounted. */
|
|
99
|
+
readonly mounted: Date;
|
|
100
|
+
/** Each unit a touch placed, as it lands. */
|
|
101
|
+
readonly onPlaced?: (receipt: Receipt) => void;
|
|
102
|
+
/** The descriptors this drive opened. One mount shares them across every
|
|
103
|
+
* ground it serves, so a file opened before a pause is read after it. */
|
|
104
|
+
readonly owned?: Set<number>;
|
|
105
|
+
}
|
|
106
|
+
/** A kernel path as the drive's address: `/` is the root, `[]`. */
|
|
107
|
+
export declare function addressOf(path: string): string[];
|
|
108
|
+
export declare function driveOperations({ drive, shelf, home, uid, gid, mounted, onPlaced, owned, }: DriveOperationsInput): DriveOperations;
|
|
109
|
+
/** Operations that each answer ENOTCONN, as a drive whose server is gone. */
|
|
110
|
+
export declare function resting(names: readonly string[]): DriveOperations;
|
|
111
|
+
export declare function errno(code: string): Error & {
|
|
112
|
+
code: string;
|
|
113
|
+
};
|
|
114
|
+
/** What a mount answers through: one ground's drive and its shelves. */
|
|
115
|
+
export type ServingDrive = Pick<DriveOperationsInput, "drive" | "shelf" | "home" | "onPlaced">;
|
|
116
|
+
/** A drive the kernel serves at its mountpoint, through either adapter. */
|
|
117
|
+
export interface MountedDrive {
|
|
118
|
+
/** Answers through this drive from now on: the one over the ground that
|
|
119
|
+
* converged last. The mount stays. */
|
|
120
|
+
serve(drive: ServingDrive): void;
|
|
121
|
+
/** Answers as a drive whose server is gone, until it serves again: its
|
|
122
|
+
* ground closed. */
|
|
123
|
+
rest(): void;
|
|
124
|
+
unmount(): Promise<void>;
|
|
125
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The drive's answer to each filesystem operation, for whichever kernel
|
|
3
|
+
* adapter serves it: FUSE on Linux (fuse.ts), NFS on macOS (nfs/). Every
|
|
4
|
+
* operation is answered by one rule: judge the address with the drive;
|
|
5
|
+
* looking, listing and stat place nothing; any operation that opens,
|
|
6
|
+
* changes, removes, renames or follows an address touches it first, and a
|
|
7
|
+
* creation touches the address it creates at so its ancestors stand; then
|
|
8
|
+
* the operation runs on the shelf's own path, on the shelf of the root the
|
|
9
|
+
* judgment names: the home's, or the root a reference led into. Inside an
|
|
10
|
+
* unplaced repository the map cannot see, so there a stat or a listing
|
|
11
|
+
* places the repository first (the drive's named exception).
|
|
12
|
+
*
|
|
13
|
+
* Unknown stays unknown: a never-placed file's size is reported as 0 because
|
|
14
|
+
* the map carries no sizes, so an adapter asks again after it opens, and
|
|
15
|
+
* reads the real size. A placement that cannot finish is EIO, never ENOENT
|
|
16
|
+
* and never zero bytes.
|
|
17
|
+
*
|
|
18
|
+
* Every operation answers on the main thread of the program that serves the
|
|
19
|
+
* drive, and the kernel waits for the answer. So the shelf's I/O here is
|
|
20
|
+
* synchronous, never through the libuv pool: an operation that waited on
|
|
21
|
+
* that pool could wait behind an in-process read of the mount itself, which
|
|
22
|
+
* waits on this thread. The same fact gives the drive its own program
|
|
23
|
+
* (../files-program/) and the rest of the runtime its rule (README.md): no
|
|
24
|
+
* program goes through the mount it serves; the mount is the door for people
|
|
25
|
+
* and the programs they run.
|
|
26
|
+
*/
|
|
27
|
+
import { accessSync, chmodSync, closeSync, constants, fstatSync, fsyncSync, ftruncateSync, lchownSync, linkSync, lstatSync, lutimesSync, mkdirSync, openSync, readdirSync, readlinkSync, readSync, renameSync, rmdirSync, statfsSync, symlinkSync, truncateSync, unlinkSync, writeSync, } from "node:fs";
|
|
28
|
+
const MODE = { directory: 0o040755, file: 0o100644, link: 0o120777 };
|
|
29
|
+
/** A kernel path as the drive's address: `/` is the root, `[]`. */
|
|
30
|
+
export function addressOf(path) {
|
|
31
|
+
return path === "/" ? [] : path.slice(1).split("/");
|
|
32
|
+
}
|
|
33
|
+
export function driveOperations({ drive, shelf, home, uid, gid, mounted, onPlaced, owned = new Set(), }) {
|
|
34
|
+
// `owned` is the only set of descriptors this drive reads, writes or
|
|
35
|
+
// closes, so a stray number from the kernel is EBADF, never another
|
|
36
|
+
// program's file.
|
|
37
|
+
/** The shelf's own path of a judgment that names its root and address. */
|
|
38
|
+
const at = (where) => shelf(where.root).path(where.address);
|
|
39
|
+
/** The address once everything an operation there needs is placed: the
|
|
40
|
+
* shelf speaks for it, on the root the walk ended in. */
|
|
41
|
+
async function touched(path) {
|
|
42
|
+
const { where, placed } = await drive.touch(addressOf(path));
|
|
43
|
+
for (const receipt of placed)
|
|
44
|
+
onPlaced?.(receipt);
|
|
45
|
+
switch (where.kind) {
|
|
46
|
+
case "shelf": return where;
|
|
47
|
+
case "nowhere": throw errno("ENOENT");
|
|
48
|
+
case "notdir": throw errno("ENOTDIR");
|
|
49
|
+
default: throw errno("EIO");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function synthetic(entry) {
|
|
53
|
+
return {
|
|
54
|
+
mode: MODE[entry.kind] | (entry.kind === "file" && entry.mode === 0o755 ? 0o111 : 0),
|
|
55
|
+
size: 0, nlink: entry.kind === "directory" ? 2 : 1, uid, gid, atime: mounted, mtime: mounted, ctime: mounted,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** The kernel's view of an address nobody has touched: the shelf's, or
|
|
59
|
+
* the map's entry; inside an unplaced repository the repository is placed. */
|
|
60
|
+
async function looked(path) {
|
|
61
|
+
const where = await drive.where(addressOf(path));
|
|
62
|
+
switch (where.kind) {
|
|
63
|
+
case "shelf": return where;
|
|
64
|
+
case "listed": return where;
|
|
65
|
+
case "beneath": return touched(path);
|
|
66
|
+
case "notdir": throw errno("ENOTDIR");
|
|
67
|
+
default: throw errno("ENOENT");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function opened(where, flags, mode) {
|
|
71
|
+
const fd = openSync(at(where), flags, mode);
|
|
72
|
+
owned.add(fd);
|
|
73
|
+
return fd;
|
|
74
|
+
}
|
|
75
|
+
const handle = (fd) => {
|
|
76
|
+
if (!owned.has(fd))
|
|
77
|
+
throw errno("EBADF");
|
|
78
|
+
return fd;
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
async getattr(path) {
|
|
82
|
+
const where = await looked(path);
|
|
83
|
+
return where.kind === "listed" ? synthetic(where.entry) : lstatSync(at(where));
|
|
84
|
+
},
|
|
85
|
+
async fgetattr(_path, fd) { return fstatSync(handle(fd)); },
|
|
86
|
+
async place(path) { return lstatSync(at(await touched(path))); },
|
|
87
|
+
async access(path, mode) {
|
|
88
|
+
const where = await looked(path);
|
|
89
|
+
if (where.kind === "shelf")
|
|
90
|
+
accessSync(at(where), mode);
|
|
91
|
+
},
|
|
92
|
+
async readdir(path) {
|
|
93
|
+
const listed = await drive.list(addressOf(path));
|
|
94
|
+
switch (listed.kind) {
|
|
95
|
+
case "entries": {
|
|
96
|
+
const added = listed.entries.map((entry) => entry.name);
|
|
97
|
+
return listed.complete ? added : [...readdirSync(at(listed)), ...added];
|
|
98
|
+
}
|
|
99
|
+
case "place-first": return readdirSync(at(await touched(path)));
|
|
100
|
+
case "notdir": throw errno("ENOTDIR");
|
|
101
|
+
default: throw errno("ENOENT");
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
async opendir(path) { await looked(path); return 0; },
|
|
105
|
+
async releasedir() { },
|
|
106
|
+
async statfs() {
|
|
107
|
+
const s = statfsSync(shelf(home).directory);
|
|
108
|
+
return {
|
|
109
|
+
bsize: s.bsize, frsize: s.bsize, blocks: s.blocks, bfree: s.bfree, bavail: s.bavail,
|
|
110
|
+
files: s.files, ffree: s.ffree, favail: s.ffree, fsid: 0, flag: 0, namemax: 255,
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
async open(path, flags) { return opened(await touched(path), flags); },
|
|
114
|
+
async create(path, mode) { return opened(await touched(path), constants.O_CREAT | constants.O_RDWR, mode); },
|
|
115
|
+
async read(_path, fd, buffer, length, position) { return readSync(handle(fd), buffer, 0, length, position); },
|
|
116
|
+
async write(_path, fd, buffer, length, position) { return writeSync(handle(fd), buffer, 0, length, position); },
|
|
117
|
+
async release(_path, fd) { owned.delete(handle(fd)); closeSync(fd); },
|
|
118
|
+
async flush() { },
|
|
119
|
+
async fsync(_path, _datasync, fd) { fsyncSync(handle(fd)); },
|
|
120
|
+
async truncate(path, size) { truncateSync(at(await touched(path)), size); },
|
|
121
|
+
async ftruncate(_path, fd, size) { ftruncateSync(handle(fd), size); },
|
|
122
|
+
async utimens(path, atime, mtime) { lutimesSync(at(await touched(path)), new Date(atime), new Date(mtime)); },
|
|
123
|
+
async chmod(path, mode) { chmodSync(at(await touched(path)), mode); },
|
|
124
|
+
async chown(path, owner, group) { lchownSync(at(await touched(path)), owner, group); },
|
|
125
|
+
async readlink(path) { return readlinkSync(at(await touched(path))); },
|
|
126
|
+
async unlink(path) { unlinkSync(at(await touched(path))); },
|
|
127
|
+
async rmdir(path) { rmdirSync(at(await touched(path))); },
|
|
128
|
+
async mkdir(path, mode) { mkdirSync(at(await touched(path)), { mode }); },
|
|
129
|
+
async symlink(target, path) { symlinkSync(target, at(await touched(path))); },
|
|
130
|
+
async rename(from, to) { const a = await touched(from); const b = await touched(to); renameSync(at(a), at(b)); },
|
|
131
|
+
async link(from, to) { const a = await touched(from); const b = await touched(to); linkSync(at(a), at(b)); },
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** Operations that each answer ENOTCONN, as a drive whose server is gone. */
|
|
135
|
+
export function resting(names) {
|
|
136
|
+
return Object.fromEntries(names.map((name) => [name, () => Promise.reject(errno("ENOTCONN"))]));
|
|
137
|
+
}
|
|
138
|
+
export function errno(code) {
|
|
139
|
+
return Object.assign(new Error(code), { code });
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/drive/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EACjH,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EACxG,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,GACjD,MAAM,SAAS,CAAC;AAMjB,MAAM,IAAI,GAA8B,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AA0EhG,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAKD,MAAM,UAAU,eAAe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AI,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7G,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,OAAO,CAAC,KAAwB;IAC9C,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAA+B,CAAC;AAChI,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error as facts a process channel carries. Node's advanced serialization
|
|
3
|
+
* keeps an Error's name and message but drops its own properties (`code`,
|
|
4
|
+
* `stages`, …), and those are what callers branch on, so they cross beside
|
|
5
|
+
* it. A property no channel can carry stays behind; the message still says
|
|
6
|
+
* what went wrong.
|
|
7
|
+
*
|
|
8
|
+
* A cause that is an error crosses too, because the place a failure happened
|
|
9
|
+
* is its innermost stack (background-error.ts). Only what says where and what
|
|
10
|
+
* crosses for it: nothing branches on a cause's properties across the channel,
|
|
11
|
+
* and a Git failure's hold all of Git's output.
|
|
12
|
+
*/
|
|
13
|
+
interface CauseFacts {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly stack?: string;
|
|
17
|
+
readonly cause?: CauseFacts;
|
|
18
|
+
}
|
|
19
|
+
export interface ErrorFacts extends CauseFacts {
|
|
20
|
+
readonly properties: Readonly<Record<string, unknown>>;
|
|
21
|
+
}
|
|
22
|
+
export declare function errorFacts(error: unknown): ErrorFacts;
|
|
23
|
+
export declare function reviveError(facts: ErrorFacts): Error;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** How many causes cross under one error, because a cause can loop back to it. */
|
|
2
|
+
const CAUSES_CARRIED = 16;
|
|
3
|
+
function causeFacts(error, causesLeft) {
|
|
4
|
+
return {
|
|
5
|
+
name: error.name,
|
|
6
|
+
message: error.message,
|
|
7
|
+
...(error.stack ? { stack: error.stack } : {}),
|
|
8
|
+
...(error.cause instanceof Error && causesLeft > 0 ? { cause: causeFacts(error.cause, causesLeft - 1) } : {}),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export function errorFacts(error) {
|
|
12
|
+
if (!(error instanceof Error))
|
|
13
|
+
return { name: "Error", message: String(error), properties: {} };
|
|
14
|
+
const properties = {};
|
|
15
|
+
for (const [key, value] of Object.entries(error)) {
|
|
16
|
+
if (key === "cause")
|
|
17
|
+
continue;
|
|
18
|
+
try {
|
|
19
|
+
properties[key] = structuredClone(value);
|
|
20
|
+
}
|
|
21
|
+
catch { /* not carried */ }
|
|
22
|
+
}
|
|
23
|
+
return { ...causeFacts(error, CAUSES_CARRIED), properties };
|
|
24
|
+
}
|
|
25
|
+
function revivedCause(facts) {
|
|
26
|
+
const error = new Error(facts.message, facts.cause ? { cause: revivedCause(facts.cause) } : undefined);
|
|
27
|
+
error.name = facts.name;
|
|
28
|
+
if (facts.stack)
|
|
29
|
+
error.stack = facts.stack;
|
|
30
|
+
return error;
|
|
31
|
+
}
|
|
32
|
+
export function reviveError(facts) {
|
|
33
|
+
return Object.assign(revivedCause(facts), facts.properties);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=error-facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-facts.js","sourceRoot":"","sources":["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