@amalgm/shell 0.1.164-main.41474889901 → 0.1.164-main.41541851444
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 +6 -6
- package/package.json +5 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MountedDrive, ServingDrive } from "./operations.js";
|
|
2
|
+
export interface DoorInput extends ServingDrive {
|
|
3
|
+
readonly mountpoint: string;
|
|
4
|
+
/** A private folder where the door keeps what a mount needs across Files
|
|
5
|
+
* programs. */
|
|
6
|
+
readonly state: string;
|
|
7
|
+
/** What `standing` answered for the mountpoint. */
|
|
8
|
+
readonly standing: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface KernelDoor {
|
|
11
|
+
/** Whether a mount an earlier Files program left stands at the
|
|
12
|
+
* mountpoint. It is served again, and nothing looks beneath it. */
|
|
13
|
+
standing(mountpoint: string): Promise<boolean>;
|
|
14
|
+
/** Resolves once the kernel serves the drive at the mountpoint. */
|
|
15
|
+
mount(input: DoorInput): Promise<MountedDrive>;
|
|
16
|
+
}
|
|
17
|
+
export declare function kernelDoor(platform?: NodeJS.Platform): Promise<KernelDoor>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The door the kernel serves the drive through on this computer: FUSE on
|
|
3
|
+
* Linux (fuse.ts), its own NFS client on macOS (nfs.ts). Both answer every
|
|
4
|
+
* operation by the one rule (operations.ts); doors differ only in how a
|
|
5
|
+
* mount stands, and in how one an earlier Files program left is found.
|
|
6
|
+
*/
|
|
7
|
+
import { lstatSync } from "node:fs";
|
|
8
|
+
import { loadFuse, mountDrive } from "./fuse.js";
|
|
9
|
+
import { mountNfs, nfsStanding } from "./nfs.js";
|
|
10
|
+
export async function kernelDoor(platform = process.platform) {
|
|
11
|
+
if (platform === "darwin")
|
|
12
|
+
return { standing: nfsStanding, mount: (input) => mountNfs(input) };
|
|
13
|
+
const fuse = await loadFuse();
|
|
14
|
+
return {
|
|
15
|
+
// A FUSE mount whose program stopped answers ENOTCONN; fuse-native's
|
|
16
|
+
// `force` clears it as it mounts again.
|
|
17
|
+
async standing(mountpoint) {
|
|
18
|
+
try {
|
|
19
|
+
lstatSync(mountpoint);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
const code = error.code;
|
|
24
|
+
return code === "ENOTCONN" || code === "ENXIO";
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
mount: ({ mountpoint, drive, shelf, home, onPlaced }) => mountDrive({
|
|
28
|
+
mountpoint, fuse, drive, shelf, home, ...(onPlaced ? { onPlaced } : {}),
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=kernel.js.map
|
|
@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
|
@@ -9,6 +9,8 @@ export interface DriveLayout {
|
|
|
9
9
|
home(email: string): string;
|
|
10
10
|
/** The private shelf of a root this computer never bound. */
|
|
11
11
|
rootShelf(rootUUID: string): string;
|
|
12
|
+
/** What the person's mount keeps across Files programs. */
|
|
13
|
+
mountState(email: string): string;
|
|
12
14
|
}
|
|
13
15
|
export declare function driveLayout(lane: {
|
|
14
16
|
readonly root: string;
|
package/dist/drive/layout.js
CHANGED
|
@@ -8,22 +8,26 @@
|
|
|
8
8
|
* same directory (@amalgm/live/drive README): the runtime's own ground for the
|
|
9
9
|
* person, the home shelf, stands at a private place of the lane's,
|
|
10
10
|
* `<lane>/drive/homes/<user>`, and a workspace this computer never bound gets
|
|
11
|
-
* `<lane>/drive/roots/<uuid>` when its first placement binds it.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* `<lane>/drive/roots/<uuid>` when its first placement binds it. What a
|
|
12
|
+
* mount keeps across Files programs (macOS's NFS handles and port) stands at
|
|
13
|
+
* `<lane>/drive/mounts/<user>`. No private place has a `.amalgm` segment:
|
|
14
|
+
* Core's `isLocalOnlyPath` reads the whole absolute path
|
|
15
|
+
* (files-browser-host.ts), and a shelf under one would be refused as
|
|
16
|
+
* local-only ground.
|
|
15
17
|
*/
|
|
16
18
|
import { userFolderName } from "@amalgm/core/identity";
|
|
17
19
|
import { join } from "node:path";
|
|
18
20
|
export function driveLayout(lane) {
|
|
19
21
|
const homes = join(lane.root, "drive", "homes");
|
|
20
22
|
const roots = join(lane.root, "drive", "roots");
|
|
23
|
+
const mounts = join(lane.root, "drive", "mounts");
|
|
21
24
|
return {
|
|
22
25
|
homes,
|
|
23
26
|
roots,
|
|
24
27
|
mountpoint: (email) => lane.user(email),
|
|
25
28
|
home: (email) => join(homes, userFolderName(email)),
|
|
26
29
|
rootShelf: (rootUUID) => join(roots, segment(rootUUID)),
|
|
30
|
+
mountState: (email) => join(mounts, userFolderName(email)),
|
|
27
31
|
};
|
|
28
32
|
}
|
|
29
33
|
/** One path segment: a root UUID as the map carries it, never a path. */
|
package/dist/drive/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/drive/layout.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/drive/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAiBjC,MAAM,UAAU,WAAW,CAAC,IAA4D;IACtF,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAClD,OAAO;QACL,KAAK;QACL,KAAK;QACL,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;QACvC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;QACnD,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvD,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;KAC3D,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,SAAS,OAAO,CAAC,QAAgB;IAC/B,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACpH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/drive/mount.d.ts
CHANGED
|
@@ -32,12 +32,14 @@ export interface ComposeDriveInput {
|
|
|
32
32
|
* computer never bound has its private shelf from the layout; nothing stands
|
|
33
33
|
* there until a placement binds it. */
|
|
34
34
|
export declare function composeDrive(ground: DriveGround, input: ComposeDriveInput): Promise<ComposedDrive>;
|
|
35
|
-
/** The two conditions the drive mounts under, checked before
|
|
36
|
-
* shelf holds the person's `.amalgmignore`: real bytes,
|
|
37
|
-
* never served on demand. The mountpoint stands apart from
|
|
38
|
-
* the runtime never reads through its own mount, and is
|
|
39
|
-
* directory, so no ground is ever hidden under the drive
|
|
40
|
-
|
|
35
|
+
/** The two conditions the drive mounts under, checked before the kernel
|
|
36
|
+
* door. The home shelf holds the person's `.amalgmignore`: real bytes,
|
|
37
|
+
* placed at login, never served on demand. The mountpoint stands apart from
|
|
38
|
+
* the shelf, since the runtime never reads through its own mount, and is
|
|
39
|
+
* absent or an empty directory, so no ground is ever hidden under the drive;
|
|
40
|
+
* a mount an earlier Files program left `standing` there was checked when it
|
|
41
|
+
* first mounted, and is never looked into. */
|
|
42
|
+
export declare function assertServable(home: string, mountpoint: string, standing?: boolean): void;
|
|
41
43
|
export interface ServedDrive {
|
|
42
44
|
/** The home's root UUID. */
|
|
43
45
|
readonly home: string;
|
|
@@ -50,10 +52,18 @@ export interface ServedDrive {
|
|
|
50
52
|
* an unplaced repository the repository is placed first, as any look there
|
|
51
53
|
* is. */
|
|
52
54
|
folder(address: readonly string[]): Promise<boolean>;
|
|
55
|
+
/** Serves the drive over the ground that converged next, through the same
|
|
56
|
+
* mount. */
|
|
57
|
+
serve(ground: DriveGround): Promise<void>;
|
|
58
|
+
/** Answers ENOTCONN until a ground serves again: its ground closed. */
|
|
59
|
+
rest(): void;
|
|
60
|
+
/** For the whole runtime's stop only. */
|
|
53
61
|
unmount(): Promise<void>;
|
|
54
62
|
}
|
|
55
63
|
export interface ServeDriveInput extends ComposeDriveInput {
|
|
56
64
|
readonly mountpoint: string;
|
|
65
|
+
/** A private folder for what the mount keeps across Files programs. */
|
|
66
|
+
readonly mountState: string;
|
|
57
67
|
readonly onPlaced?: (receipt: Receipt) => void;
|
|
58
68
|
}
|
|
59
69
|
/** Composes the home's drive and mounts it at the conventional home. */
|
package/dist/drive/mount.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The home served on demand
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
2
|
+
* The home served on demand: one drive at the person's conventional home,
|
|
3
|
+
* over the home shelf and the shelf of every root a reference leads to, with
|
|
4
|
+
* the host's placer, through this computer's kernel door (kernel.ts): FUSE
|
|
5
|
+
* on Linux, NFS on macOS. The Files program serves it beside
|
|
6
|
+
* the ground host (../files-program/): no program goes through a mount it
|
|
7
|
+
* serves, and the runtime starts programs whose working folder is on the
|
|
8
|
+
* drive. Each root's map comes from the ground host and reads the SQLite the
|
|
9
|
+
* Apply rail writes, it wakes when the line moves, and a placement in flight
|
|
10
|
+
* counts as `live placing`, so a mount with a fetch under way is not idle.
|
|
11
|
+
*
|
|
12
|
+
* The mount stands from the first serve until the whole runtime stops. When
|
|
13
|
+
* its ground closes (sync paused) it rests, answering ENOTCONN, and the
|
|
14
|
+
* ground that converges next serves through the same mount. A Files program
|
|
15
|
+
* that stops leaves the mount standing until the next one serves it: FUSE
|
|
16
|
+
* answers ENOTCONN meanwhile; NFS waits for the next program.
|
|
9
17
|
*
|
|
10
18
|
* Two laws hold before anything mounts (layout.ts, `assertServable`): the
|
|
11
19
|
* home shelf holds the person's `.amalgmignore`, and the mountpoint stands
|
|
@@ -22,7 +30,7 @@ import { USER_IGNORE_FILE_NAME } from "@amalgm/core/identity";
|
|
|
22
30
|
import { Drive } from "@amalgm/live/drive";
|
|
23
31
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
24
32
|
import { join, resolve, sep } from "node:path";
|
|
25
|
-
import {
|
|
33
|
+
import { kernelDoor } from "./kernel.js";
|
|
26
34
|
import { shelfOf } from "./shelf.js";
|
|
27
35
|
/** The drive of the home over this machine's shelves: the home's at once,
|
|
28
36
|
* each referenced root's when the walk first enters it. A root this
|
|
@@ -60,12 +68,14 @@ export async function composeDrive(ground, input) {
|
|
|
60
68
|
},
|
|
61
69
|
};
|
|
62
70
|
}
|
|
63
|
-
/** The two conditions the drive mounts under, checked before
|
|
64
|
-
* shelf holds the person's `.amalgmignore`: real bytes,
|
|
65
|
-
* never served on demand. The mountpoint stands apart from
|
|
66
|
-
* the runtime never reads through its own mount, and is
|
|
67
|
-
* directory, so no ground is ever hidden under the drive
|
|
68
|
-
|
|
71
|
+
/** The two conditions the drive mounts under, checked before the kernel
|
|
72
|
+
* door. The home shelf holds the person's `.amalgmignore`: real bytes,
|
|
73
|
+
* placed at login, never served on demand. The mountpoint stands apart from
|
|
74
|
+
* the shelf, since the runtime never reads through its own mount, and is
|
|
75
|
+
* absent or an empty directory, so no ground is ever hidden under the drive;
|
|
76
|
+
* a mount an earlier Files program left `standing` there was checked when it
|
|
77
|
+
* first mounted, and is never looked into. */
|
|
78
|
+
export function assertServable(home, mountpoint, standing = false) {
|
|
69
79
|
const shelf = resolve(home);
|
|
70
80
|
const at = resolve(mountpoint);
|
|
71
81
|
if (shelf === at || at.startsWith(shelf + sep) || shelf.startsWith(at + sep)) {
|
|
@@ -74,31 +84,39 @@ export function assertServable(home, mountpoint) {
|
|
|
74
84
|
if (!existsSync(join(shelf, USER_IGNORE_FILE_NAME))) {
|
|
75
85
|
throw new Error(`the home shelf ${shelf} holds no ${USER_IGNORE_FILE_NAME}: the person's sharing policy is placed at login, before anything is listed`);
|
|
76
86
|
}
|
|
77
|
-
|
|
87
|
+
if (standing)
|
|
88
|
+
return;
|
|
89
|
+
let folder;
|
|
78
90
|
try {
|
|
79
|
-
|
|
91
|
+
folder = lstatSync(at);
|
|
80
92
|
}
|
|
81
93
|
catch {
|
|
82
94
|
return;
|
|
83
95
|
}
|
|
84
|
-
if (!
|
|
96
|
+
if (!folder.isDirectory())
|
|
85
97
|
throw new Error(`${at} is not a directory: the drive mounts at the person's conventional home`);
|
|
86
98
|
if (readdirSync(at).length > 0)
|
|
87
99
|
throw new Error(`${at} holds files: the drive mounts only at an empty or absent home, so no ground is hidden under it`);
|
|
88
100
|
}
|
|
89
101
|
/** Composes the home's drive and mounts it at the conventional home. */
|
|
90
102
|
export async function serveDrive(ground, input) {
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const home =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
const door = await kernelDoor();
|
|
104
|
+
const first = await composeDrive(ground, input);
|
|
105
|
+
const home = first.shelf(first.home);
|
|
106
|
+
const standing = await door.standing(input.mountpoint);
|
|
107
|
+
assertServable(home.directory, input.mountpoint, standing);
|
|
108
|
+
const serving = (composed) => ({
|
|
109
|
+
drive: composed.drive, home: composed.home, shelf: (rootUUID) => composed.shelf(rootUUID),
|
|
97
110
|
...(input.onPlaced ? { onPlaced: input.onPlaced } : {}),
|
|
98
111
|
});
|
|
112
|
+
const mounted = await door.mount({ mountpoint: input.mountpoint, state: input.mountState, standing, ...serving(first) });
|
|
113
|
+
let current = first;
|
|
99
114
|
return {
|
|
100
|
-
home:
|
|
115
|
+
home: first.home, mountpoint: input.mountpoint, shelf: home.directory,
|
|
101
116
|
folder: async (address) => {
|
|
117
|
+
const composed = current;
|
|
118
|
+
if (composed === null)
|
|
119
|
+
return false;
|
|
102
120
|
let where = await composed.drive.where(address);
|
|
103
121
|
if (where.kind === "beneath") {
|
|
104
122
|
const touched = await composed.drive.touch(address);
|
|
@@ -117,6 +135,14 @@ export async function serveDrive(ground, input) {
|
|
|
117
135
|
return false;
|
|
118
136
|
}
|
|
119
137
|
},
|
|
138
|
+
serve: async (next) => {
|
|
139
|
+
current = await composeDrive(next, input);
|
|
140
|
+
mounted.serve(serving(current));
|
|
141
|
+
},
|
|
142
|
+
rest: () => {
|
|
143
|
+
current = null;
|
|
144
|
+
mounted.rest();
|
|
145
|
+
},
|
|
120
146
|
unmount: () => mounted.unmount(),
|
|
121
147
|
};
|
|
122
148
|
}
|
package/dist/drive/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../src/drive/mount.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../src/drive/mount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,KAAK,EAA0D,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AA8BjD;;;uCAGuC;AACvC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAmB,EAAE,KAAwB;IAC9E,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC/C,MAAM,KAAK,GAAG,KAAK,EAAE,QAAgB,EAA+B,EAAE;QACpE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;QACxB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,C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EAAE,CAAC;gBAC7B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACpD,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,MAAM;oBAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC;gBAChE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YACxB,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;YACrE,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;gBAAE,OAAO,KAAK,CAAC;YACzC,IAAI,CAAC;gBACH,OAAO,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACjF,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACpB,OAAO,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC1C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,EAAE,GAAG,EAAE;YACT,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The command, and its arguments before the folder, that locks a folder. */
|
|
2
|
+
export type FolderLock = readonly [command: string, ...args: string[]];
|
|
3
|
+
/** How a door's platform locks the drive's folder for a user, or null where
|
|
4
|
+
* that user's mounter cannot mount on a locked folder and the folder stays an
|
|
5
|
+
* ordinary one. On macOS the owner's immutable flag (Finder's "Locked"),
|
|
6
|
+
* which `mount_nfs` mounts on as an ordinary user. On Linux the immutable
|
|
7
|
+
* attribute, which only root may set, and FUSE mounts on an immutable folder
|
|
8
|
+
* only as root. */
|
|
9
|
+
export declare function folderLock(platform: "darwin" | "linux", uid?: number): FolderLock | null;
|
|
10
|
+
/** Stands the folder the drive mounts on: made if absent, then locked. A
|
|
11
|
+
* lock that fails is a fault: the drive never mounts without it. A dead
|
|
12
|
+
* mount a stopped Files program left (FUSE: ENOTCONN) stands over a folder
|
|
13
|
+
* already stood, and is left to the door that clears it. */
|
|
14
|
+
export declare function standMountpoint(mountpoint: string, lock: FolderLock | null): Promise<void>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bare folder the drive mounts on. Anything written into it while no
|
|
3
|
+
* drive answers there would be hidden under the drive when it mounts again,
|
|
4
|
+
* or keep it from mounting. So, wherever this computer's mounter can still
|
|
5
|
+
* mount on a folder that refuses every write, the folder is locked before it
|
|
6
|
+
* is first mounted, and stays locked: a write in any gap is refused, never
|
|
7
|
+
* hidden. Both doors stand their folder here.
|
|
8
|
+
*/
|
|
9
|
+
import { execFile } from "node:child_process";
|
|
10
|
+
import { lstatSync, mkdirSync } from "node:fs";
|
|
11
|
+
import { promisify } from "node:util";
|
|
12
|
+
const execFileAsync = promisify(execFile);
|
|
13
|
+
/** How a door's platform locks the drive's folder for a user, or null where
|
|
14
|
+
* that user's mounter cannot mount on a locked folder and the folder stays an
|
|
15
|
+
* ordinary one. On macOS the owner's immutable flag (Finder's "Locked"),
|
|
16
|
+
* which `mount_nfs` mounts on as an ordinary user. On Linux the immutable
|
|
17
|
+
* attribute, which only root may set, and FUSE mounts on an immutable folder
|
|
18
|
+
* only as root. */
|
|
19
|
+
export function folderLock(platform, uid = process.getuid?.() ?? -1) {
|
|
20
|
+
if (platform === "darwin")
|
|
21
|
+
return ["/usr/bin/chflags", "uchg"];
|
|
22
|
+
return uid === 0 ? ["chattr", "+i"] : null;
|
|
23
|
+
}
|
|
24
|
+
/** Stands the folder the drive mounts on: made if absent, then locked. A
|
|
25
|
+
* lock that fails is a fault: the drive never mounts without it. A dead
|
|
26
|
+
* mount a stopped Files program left (FUSE: ENOTCONN) stands over a folder
|
|
27
|
+
* already stood, and is left to the door that clears it. */
|
|
28
|
+
export async function standMountpoint(mountpoint, lock) {
|
|
29
|
+
try {
|
|
30
|
+
lstatSync(mountpoint);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const code = error.code;
|
|
34
|
+
if (code === "ENOTCONN" || code === "ENXIO")
|
|
35
|
+
return;
|
|
36
|
+
if (code !== "ENOENT")
|
|
37
|
+
throw error;
|
|
38
|
+
mkdirSync(mountpoint, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
if (lock === null)
|
|
41
|
+
return;
|
|
42
|
+
const [command, ...args] = lock;
|
|
43
|
+
try {
|
|
44
|
+
await execFileAsync(command, [...args, mountpoint]);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
48
|
+
throw new Error(`the drive's folder ${mountpoint} could not be locked (${lock.join(" ")}), so it does not mount: ${reason}`, { cause: error });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=mountpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mountpoint.js","sourceRoot":"","sources":["../../src/drive/mountpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAK1C;;;;;m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E,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACjJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type DriveOperations } from "../operations.js";
|
|
2
|
+
/** Whether a kernel path names an AppleDouble sidecar. */
|
|
3
|
+
export declare function isSidecar(path: string): boolean;
|
|
4
|
+
/** The drive's operations with every sidecar answered from `folder`, a
|
|
5
|
+
* private folder that is no ground of the drive's. */
|
|
6
|
+
export declare function appleDoubleKeptHere(drive: DriveOperations, folder: string): DriveOperations;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Mac's extended attributes on the drive, kept on this computer.
|
|
3
|
+
*
|
|
4
|
+
* NFS version 3 carries no extended attributes, so macOS's client keeps a
|
|
5
|
+
* file's own, its download quarantine among them, in an AppleDouble file
|
|
6
|
+
* beside it: `._name` beside `name`, written and read with ordinary calls.
|
|
7
|
+
* Extended attributes are this computer's posture, never a file's portable
|
|
8
|
+
* state, and a Mac's own disk shows no such file. So the NFS door keeps every
|
|
9
|
+
* `._` name in a folder of its own on this computer, at the kernel path it
|
|
10
|
+
* names, never on a shelf: Detect never sees one, nothing publishes one, and
|
|
11
|
+
* a file keeps its quarantine here. A listing never shows a `._` name; a `._`
|
|
12
|
+
* file another computer shares stays out of view on a Mac's drive, which
|
|
13
|
+
* reads that name as a sidecar.
|
|
14
|
+
*
|
|
15
|
+
* A sidecar follows its file through the client's own renames and removes,
|
|
16
|
+
* which name both. A change another computer makes moves only the file: its
|
|
17
|
+
* sidecar stays at the old path, and the file shows no attributes here.
|
|
18
|
+
*/
|
|
19
|
+
import { accessSync, chmodSync, closeSync, constants, fstatSync, fsyncSync, ftruncateSync, lchownSync, linkSync, lstatSync, lutimesSync, mkdirSync, openSync, readdirSync, readlinkSync, readSync, renameSync, rmdirSync, symlinkSync, truncateSync, unlinkSync, writeSync, } from "node:fs";
|
|
20
|
+
import { dirname, join } from "node:path";
|
|
21
|
+
import { errno } from "../operations.js";
|
|
22
|
+
/** How every AppleDouble sidecar's name begins. */
|
|
23
|
+
const SIDECAR = "._";
|
|
24
|
+
/** Whether a kernel path names an AppleDouble sidecar. */
|
|
25
|
+
export function isSidecar(path) {
|
|
26
|
+
return path.startsWith(SIDECAR, path.lastIndexOf("/") + 1);
|
|
27
|
+
}
|
|
28
|
+
/** The drive's operations with every sidecar answered from `folder`, a
|
|
29
|
+
* private folder that is no ground of the drive's. */
|
|
30
|
+
export function appleDoubleKeptHere(drive, folder) {
|
|
31
|
+
const mine = new Set();
|
|
32
|
+
const at = (path) => join(folder, path);
|
|
33
|
+
/** A sidecar's path with its folder standing, for an operation that makes one. */
|
|
34
|
+
const making = (path) => {
|
|
35
|
+
mkdirSync(dirname(at(path)), { recursive: true, mode: 0o700 });
|
|
36
|
+
return at(path);
|
|
37
|
+
};
|
|
38
|
+
const opened = (fd) => {
|
|
39
|
+
mine.add(fd);
|
|
40
|
+
return fd;
|
|
41
|
+
};
|
|
42
|
+
const handle = (fd) => {
|
|
43
|
+
if (!mine.has(fd))
|
|
44
|
+
throw errno("EBADF");
|
|
45
|
+
return fd;
|
|
46
|
+
};
|
|
47
|
+
/** Both ends of a rename or link: sidecars, or neither. One of each would
|
|
48
|
+
* move a sidecar onto ground or ground off it. */
|
|
49
|
+
const both = (from, to) => {
|
|
50
|
+
const sidecar = isSidecar(from);
|
|
51
|
+
if (sidecar !== isSidecar(to))
|
|
52
|
+
throw errno("EXDEV");
|
|
53
|
+
return sidecar;
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
...drive,
|
|
57
|
+
async getattr(path) { return isSidecar(path) ? lstatSync(at(path)) : drive.getattr(path); },
|
|
58
|
+
async fgetattr(path, fd) { return isSidecar(path) ? fstatSync(handle(fd)) : drive.fgetattr(path, fd); },
|
|
59
|
+
async place(path) { return isSidecar(path) ? lstatSync(at(path)) : drive.place(path); },
|
|
60
|
+
async access(path, mode) { if (isSidecar(path))
|
|
61
|
+
accessSync(at(path), mode);
|
|
62
|
+
else
|
|
63
|
+
await drive.access(path, mode); },
|
|
64
|
+
async readdir(path) {
|
|
65
|
+
if (isSidecar(path))
|
|
66
|
+
return readdirSync(at(path));
|
|
67
|
+
return (await drive.readdir(path)).filter((name) => !name.startsWith(SIDECAR));
|
|
68
|
+
},
|
|
69
|
+
async opendir(path, flags) { if (!isSidecar(path))
|
|
70
|
+
return drive.opendir(path, flags); lstatSync(at(path)); return 0; },
|
|
71
|
+
async open(path, flags) { return isSidecar(path) ? opened(openSync(at(path), flags)) : drive.open(path, flags); },
|
|
72
|
+
async create(path, mode) {
|
|
73
|
+
return isSidecar(path) ? opened(openSync(making(path), constants.O_CREAT | constants.O_RDWR, mode)) : drive.create(path, mode);
|
|
74
|
+
},
|
|
75
|
+
async read(path, fd, buffer, length, position) {
|
|
76
|
+
return isSidecar(path) ? readSync(handle(fd), buffer, 0, length, position) : drive.read(path, fd, buffer, length, position);
|
|
77
|
+
},
|
|
78
|
+
async write(path, fd, buffer, length, position) {
|
|
79
|
+
return isSidecar(path) ? writeSync(handle(fd), buffer, 0, length, position) : drive.write(path, fd, buffer, length, position);
|
|
80
|
+
},
|
|
81
|
+
async release(path, fd) {
|
|
82
|
+
if (!isSidecar(path))
|
|
83
|
+
return drive.release(path, fd);
|
|
84
|
+
mine.delete(handle(fd));
|
|
85
|
+
closeSync(fd);
|
|
86
|
+
},
|
|
87
|
+
async fsync(path, datasync, fd) { if (isSidecar(path))
|
|
88
|
+
fsyncSync(handle(fd));
|
|
89
|
+
else
|
|
90
|
+
await drive.fsync(path, datasync, fd); },
|
|
91
|
+
async truncate(path, size) { if (isSidecar(path))
|
|
92
|
+
truncateSync(at(path), size);
|
|
93
|
+
else
|
|
94
|
+
await drive.truncate(path, size); },
|
|
95
|
+
async ftruncate(path, fd, size) { if (isSidecar(path))
|
|
96
|
+
ftruncateSync(handle(fd), size);
|
|
97
|
+
else
|
|
98
|
+
await drive.ftruncate(path, fd, size); },
|
|
99
|
+
async utimens(path, atime, mtime) {
|
|
100
|
+
if (isSidecar(path))
|
|
101
|
+
lutimesSync(at(path), new Date(atime), new Date(mtime));
|
|
102
|
+
else
|
|
103
|
+
await drive.utimens(path, atime, mtime);
|
|
104
|
+
},
|
|
105
|
+
async chmod(path, mode) { if (isSidecar(path))
|
|
106
|
+
chmodSync(at(path), mode);
|
|
107
|
+
else
|
|
108
|
+
await drive.chmod(path, mode); },
|
|
109
|
+
async chown(path, uid, gid) { if (isSidecar(path))
|
|
110
|
+
lchownSync(at(path), uid, gid);
|
|
111
|
+
else
|
|
112
|
+
await drive.chown(path, uid, gid); },
|
|
113
|
+
async readlink(path) { return isSidecar(path) ? readlinkSync(at(path)) : drive.readlink(path); },
|
|
114
|
+
async unlink(path) { if (isSidecar(path))
|
|
115
|
+
unlinkSync(at(path));
|
|
116
|
+
else
|
|
117
|
+
await drive.unlink(path); },
|
|
118
|
+
async rmdir(path) { if (isSidecar(path))
|
|
119
|
+
rmdirSync(at(path));
|
|
120
|
+
else
|
|
121
|
+
await drive.rmdir(path); },
|
|
122
|
+
async mkdir(path, mode) { if (isSidecar(path))
|
|
123
|
+
mkdirSync(making(path), { mode });
|
|
124
|
+
else
|
|
125
|
+
await drive.mkdir(path, mode); },
|
|
126
|
+
async symlink(target, path) { if (isSidecar(path))
|
|
127
|
+
symlinkSync(target, making(path));
|
|
128
|
+
else
|
|
129
|
+
await drive.symlink(target, path); },
|
|
130
|
+
async rename(from, to) { if (both(from, to))
|
|
131
|
+
renameSync(at(from), making(to));
|
|
132
|
+
else
|
|
133
|
+
await drive.rename(from, to); },
|
|
134
|
+
async link(from, to) { if (both(from, to))
|
|
135
|
+
linkSync(at(from), making(to));
|
|
136
|
+
else
|
|
137
|
+
await drive.link(from, to); },
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=apple-double.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-double.js","sourceRoot":"","sources":["../../../src/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,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YAAE,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;;YAAM,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACnH,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;;YAAM,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;KAC9G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NFSv3's shapes for what a file is and what an operation asks of it (RFC
|
|
3
|
+
* 1813): `fattr3` written from the drive's attributes, `sattr3` read into the
|
|
4
|
+
* changes a SETATTR, CREATE or MKDIR asks, and `nfsstat3` from the errno an
|
|
5
|
+
* operation failed with.
|
|
6
|
+
*/
|
|
7
|
+
import type { Stats } from "node:fs";
|
|
8
|
+
import type { Attributes } from "../operations.js";
|
|
9
|
+
import type { XdrReader, XdrWriter } from "./xdr.js";
|
|
10
|
+
/** nfsstat3: what a failed procedure tells the client. */
|
|
11
|
+
export declare const STATUS: {
|
|
12
|
+
readonly OK: 0;
|
|
13
|
+
readonly PERM: 1;
|
|
14
|
+
readonly NOENT: 2;
|
|
15
|
+
readonly IO: 5;
|
|
16
|
+
readonly ACCES: 13;
|
|
17
|
+
readonly EXIST: 17;
|
|
18
|
+
readonly XDEV: 18;
|
|
19
|
+
readonly NOTDIR: 20;
|
|
20
|
+
readonly ISDIR: 21;
|
|
21
|
+
readonly INVAL: 22;
|
|
22
|
+
readonly FBIG: 27;
|
|
23
|
+
readonly NOSPC: 28;
|
|
24
|
+
readonly ROFS: 30;
|
|
25
|
+
readonly MLINK: 31;
|
|
26
|
+
readonly NAMETOOLONG: 63;
|
|
27
|
+
readonly NOTEMPTY: 66;
|
|
28
|
+
readonly DQUOT: 69;
|
|
29
|
+
readonly STALE: 70;
|
|
30
|
+
readonly BADHANDLE: 10001;
|
|
31
|
+
readonly NOT_SYNC: 10002;
|
|
32
|
+
readonly NOTSUPP: 10004;
|
|
33
|
+
readonly TOOSMALL: 10005;
|
|
34
|
+
readonly SERVERFAULT: 10006;
|
|
35
|
+
};
|
|
36
|
+
/** The status for an operation's failure: a known errno by name; a placement
|
|
37
|
+
* that could not finish (a `DriveError`), a drive at rest (ENOTCONN) or
|
|
38
|
+
* anything else is IO, so missing bytes are an error, never zeros. */
|
|
39
|
+
export declare function statusOf(error: unknown): number;
|
|
40
|
+
/** One file's attributes and the number the client knows it by. */
|
|
41
|
+
export interface Described {
|
|
42
|
+
readonly attributes: Attributes | Stats;
|
|
43
|
+
readonly fileid: bigint;
|
|
44
|
+
}
|
|
45
|
+
export declare function writeFattr(w: XdrWriter, { attributes: a, fileid }: Described): void;
|
|
46
|
+
/** post_op_attr: the attributes when the server has them. */
|
|
47
|
+
export declare function writePostOpAttr(w: XdrWriter, described: Described | null): void;
|
|
48
|
+
/** wcc_data with no attributes before and the ones after, when known. */
|
|
49
|
+
export declare function writeWcc(w: XdrWriter, after: Described | null): void;
|
|
50
|
+
/** The changes a `sattr3` asks; times in milliseconds. */
|
|
51
|
+
export interface SetAttributes {
|
|
52
|
+
readonly mode?: number;
|
|
53
|
+
readonly uid?: number;
|
|
54
|
+
readonly gid?: number;
|
|
55
|
+
readonly size?: number;
|
|
56
|
+
readonly atime?: number;
|
|
57
|
+
readonly mtime?: number;
|
|
58
|
+
}
|
|
59
|
+
export declare function readSattr(r: XdrReader, now: number): SetAttributes;
|
|
60
|
+
export declare function readTime(r: XdrReader): number;
|
|
61
|
+
/** Whether two times in milliseconds are the same `nfstime3`. */
|
|
62
|
+
export declare function sameTime(a: number, b: number): boolean;
|
|
63
|
+
/** A time in milliseconds, with the fraction a `Stats` keeps. */
|
|
64
|
+
export declare function milliseconds(a: Attributes | Stats, field: "atime" | "mtime" | "ctime"): number;
|