@fnndsc/fond 0.6.1 → 0.7.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/README.md +1 -3
- package/dist/errorStack.d.ts +10 -6
- package/dist/errorStack.js +12 -9
- package/dist/errorStack.js.map +1 -1
- package/dist/heldWriter.d.ts +130 -0
- package/dist/heldWriter.js +539 -0
- package/dist/heldWriter.js.map +1 -0
- package/dist/homePath.d.ts +60 -0
- package/dist/homePath.js +117 -0
- package/dist/homePath.js.map +1 -0
- package/dist/hostPlace.d.ts +275 -0
- package/dist/hostPlace.js +777 -0
- package/dist/hostPlace.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/placedPath.d.ts +250 -0
- package/dist/placedPath.js +757 -0
- package/dist/placedPath.js.map +1 -0
- package/dist/publication.d.ts +43 -0
- package/dist/publication.js +55 -0
- package/dist/publication.js.map +1 -0
- package/dist/recordFile.d.ts +61 -0
- package/dist/recordFile.js +258 -0
- package/dist/recordFile.js.map +1 -0
- package/dist/vfs/contract.js +19 -5
- package/dist/vfs/contract.js.map +1 -1
- package/dist/vfs/dispatcher.d.ts +222 -13
- package/dist/vfs/dispatcher.js +483 -73
- package/dist/vfs/dispatcher.js.map +1 -1
- package/dist/vfs/memory.d.ts +107 -3
- package/dist/vfs/memory.js +198 -24
- package/dist/vfs/memory.js.map +1 -1
- package/dist/vfs/naming.d.ts +97 -0
- package/dist/vfs/naming.js +122 -0
- package/dist/vfs/naming.js.map +1 -0
- package/dist/vfs/outcome.d.ts +72 -2
- package/dist/vfs/outcome.js +84 -3
- package/dist/vfs/outcome.js.map +1 -1
- package/dist/vfs/provider.d.ts +191 -6
- package/dist/vfs/render.d.ts +7 -0
- package/dist/vfs/render.js +16 -13
- package/dist/vfs/render.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ fond's one rule: **it depends on nothing in `@fnndsc`**. CI holds it to that (`n
|
|
|
20
20
|
| --- | --- |
|
|
21
21
|
| `Result<T>`, `Ok`, `Err`, `result_isOk`, `result_isErr` | An explicit success-or-failure value. A function returns `Result<T>` rather than `T \| null`, and TypeScript will not let a caller read `.value` until it has checked `.ok`. |
|
|
22
22
|
| `errorStack` | The process-wide message stack that failures are reported on, with context-isolated scopes and checkpoints. |
|
|
23
|
-
| `
|
|
23
|
+
| `errorStack_getAllOfType`, `StackMessage` | A convenience reader, and the message type. |
|
|
24
24
|
| `VFSProvider`, `VFSItem`, `CpOptions` | The virtual filesystem's contracts: a mount that claims a path prefix and lists, copies and (optionally) reads, writes, makes, removes and renames under it; the items it lists. |
|
|
25
25
|
| `VFSDispatcher` | Routes each filesystem request to the mount that owns the path, or to a fallback. It knows no backend: a backend registers its mounts and names its fallback. |
|
|
26
26
|
| `vfsItems_sort` | Sorts a listing's items by name, size, date or owner without changing the array given. |
|
|
@@ -83,8 +83,6 @@ const answer: Result<Listing> = await listing_fetch(path);
|
|
|
83
83
|
const reasons: StackMessage[] = errorStack.checkpoint_drain(mark);
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
`errorStack_configure({ functionNamePadWidth })` sets how wide the function-name stamp is padded.
|
|
87
|
-
|
|
88
86
|
## The virtual filesystem
|
|
89
87
|
|
|
90
88
|
A session's filesystem is a tree of mounts. Each mount (a `VFSProvider`) claims a path prefix and answers for everything at or under it; the longest prefix that matches at a segment boundary wins, so `/proc/jobs` takes precedence over `/proc`, and `/procs` is not under `/proc`. A path no mount claims goes to the fallback.
|
package/dist/errorStack.d.ts
CHANGED
|
@@ -74,6 +74,16 @@ declare class ErrorStack {
|
|
|
74
74
|
* @returns The drained messages, oldest first.
|
|
75
75
|
*/
|
|
76
76
|
checkpoint_drain(checkpoint: number): StackMessage[];
|
|
77
|
+
/**
|
|
78
|
+
* Puts messages on the active stack as they are, without a second caller
|
|
79
|
+
* prefix: what a {@link scope_run} left behind, handed to the stack outside
|
|
80
|
+
* it once that work ends. Work run side by side, each in a scope of its
|
|
81
|
+
* own, drains its own checkpoints without taking another's messages, and
|
|
82
|
+
* what it means the caller to read still reaches the caller.
|
|
83
|
+
*
|
|
84
|
+
* @param messages - Messages taken from another stack, oldest first.
|
|
85
|
+
*/
|
|
86
|
+
stack_restore(messages: readonly StackMessage[]): void;
|
|
77
87
|
/**
|
|
78
88
|
* Get the singleton instance of the ErrorStack.
|
|
79
89
|
*
|
|
@@ -147,12 +157,6 @@ declare class ErrorStack {
|
|
|
147
157
|
* The global singleton instance of the ErrorStack.
|
|
148
158
|
*/
|
|
149
159
|
export declare const errorStack: ErrorStack;
|
|
150
|
-
/**
|
|
151
|
-
* Reconfigures the error stack with new options.
|
|
152
|
-
*
|
|
153
|
-
* @param options - The new configuration options.
|
|
154
|
-
*/
|
|
155
|
-
export declare function errorStack_configure(options: ErrorStackOptions): void;
|
|
156
160
|
/**
|
|
157
161
|
* Get all messages of a specific type from the global error stack.
|
|
158
162
|
*
|
package/dist/errorStack.js
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.errorStack = void 0;
|
|
18
|
-
exports.errorStack_configure = errorStack_configure;
|
|
19
18
|
exports.errorStack_getAllOfType = errorStack_getAllOfType;
|
|
20
19
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
21
20
|
/**
|
|
@@ -104,6 +103,18 @@ class ErrorStack {
|
|
|
104
103
|
checkpoint_drain(checkpoint) {
|
|
105
104
|
return this.stack_active().splice(checkpoint);
|
|
106
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Puts messages on the active stack as they are, without a second caller
|
|
108
|
+
* prefix: what a {@link scope_run} left behind, handed to the stack outside
|
|
109
|
+
* it once that work ends. Work run side by side, each in a scope of its
|
|
110
|
+
* own, drains its own checkpoints without taking another's messages, and
|
|
111
|
+
* what it means the caller to read still reaches the caller.
|
|
112
|
+
*
|
|
113
|
+
* @param messages - Messages taken from another stack, oldest first.
|
|
114
|
+
*/
|
|
115
|
+
stack_restore(messages) {
|
|
116
|
+
this.stack_active().push(...messages.map((message) => ({ ...message })));
|
|
117
|
+
}
|
|
107
118
|
/**
|
|
108
119
|
* Get the singleton instance of the ErrorStack.
|
|
109
120
|
*
|
|
@@ -216,14 +227,6 @@ class ErrorStack {
|
|
|
216
227
|
* The global singleton instance of the ErrorStack.
|
|
217
228
|
*/
|
|
218
229
|
exports.errorStack = ErrorStack.instance_get({ functionNamePadWidth: 40 });
|
|
219
|
-
/**
|
|
220
|
-
* Reconfigures the error stack with new options.
|
|
221
|
-
*
|
|
222
|
-
* @param options - The new configuration options.
|
|
223
|
-
*/
|
|
224
|
-
function errorStack_configure(options) {
|
|
225
|
-
ErrorStack.instance_get(options);
|
|
226
|
-
}
|
|
227
230
|
/**
|
|
228
231
|
* Get all messages of a specific type from the global error stack.
|
|
229
232
|
*
|
package/dist/errorStack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorStack.js","sourceRoot":"","sources":["../src/errorStack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;
|
|
1
|
+
{"version":3,"file":"errorStack.js","sourceRoot":"","sources":["../src/errorStack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAgRH,0DAEC;AAhRD,uDAAqD;AAmBrD;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,GAAW,EAAE,MAAc;IAC/C,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QACxB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;IAC9C,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,SAAS,uBAAuB;IAC9B,MAAM,KAAK,GAAU,IAAI,KAAK,EAAE,C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iB;QACzC,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAChE,CAAC;CACF;AAED;;GAEG;AACU,QAAA,UAAU,GAAe,UAAU,CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC;AAE5F;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,IAAiB;IACvD,OAAO,kBAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The writer's Linux backend: folders held as descriptors, every name opened, made and renamed relative to
|
|
3
|
+
* the folder it is in (through `/proc/self/fd/<fd>/<name>`), so a folder swapped for a link while a file is
|
|
4
|
+
* written never takes a byte outside the operator's root, and a held folder moved out of it is never published
|
|
5
|
+
* into: a move can carry the unfinished temporary file along with it while the stream runs, and the check before
|
|
6
|
+
* the commit then refuses the write and removes that file through the held folder.
|
|
7
|
+
*
|
|
8
|
+
* How it holds:
|
|
9
|
+
* - The root is opened `O_PATH|O_DIRECTORY|O_NOFOLLOW` and must have the identity its token recorded; each part
|
|
10
|
+
* below it is opened the same way relative to the folder before it, so no link is ever followed.
|
|
11
|
+
* - A held descriptor pins a folder, not its place: before the commit and at confirmation the held folder's
|
|
12
|
+
* kernel path must still be its expected place under the root's real spelling.
|
|
13
|
+
* - The temporary file is pinned by an `O_PATH` reopen of its own write descriptor (no name, so no race and no
|
|
14
|
+
* FIFO), held until the publication is proved, so its inode cannot be freed and reused meanwhile.
|
|
15
|
+
*
|
|
16
|
+
* Chosen once per process ({@link heldFolders_available}): `/proc` must be procfs and must name a held `/` as
|
|
17
|
+
* `/`; elsewhere the pathname writer is used.
|
|
18
|
+
*
|
|
19
|
+
* Residuals: an ancestor moved between the location check and the rename; inode reuse across NFS clients.
|
|
20
|
+
*
|
|
21
|
+
* Key components:
|
|
22
|
+
* - heldFolders_available: whether this process holds folders (probed once).
|
|
23
|
+
* - heldFolder_make, heldFile_write: the folder maker and the writer, used by placedPath.
|
|
24
|
+
*
|
|
25
|
+
* Typical usage:
|
|
26
|
+
* ```ts
|
|
27
|
+
* if (heldFolders_available()) await heldFile_write(root, parts, 0o600, shared);
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* Dependencies: Node's fs; the shared checks of placedPath, handed in.
|
|
31
|
+
*
|
|
32
|
+
* @module
|
|
33
|
+
*/
|
|
34
|
+
import { type BigIntStats } from 'node:fs';
|
|
35
|
+
import { type FileHandle } from 'node:fs/promises';
|
|
36
|
+
/**
|
|
37
|
+
* The root a token chains to.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const root: HeldRoot = { real: '/home/me/out', dev: 2049n, ino: 1234n };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface HeldRoot {
|
|
45
|
+
/** Its real path. */
|
|
46
|
+
readonly real: string;
|
|
47
|
+
/** Its device. */
|
|
48
|
+
readonly dev: bigint;
|
|
49
|
+
/** Its inode. */
|
|
50
|
+
readonly ino: bigint;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The checks of the pathname writer that the held writer shares, handed in by placedPath.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const shared: HeldShared = { root_prove, standing_judge, stream_write, unconfirmed_make, temporary: '.mise-part-00', cancel_read };
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export interface HeldShared {
|
|
61
|
+
/** Proves the root is the folder it was (real spelling and identity). */
|
|
62
|
+
root_prove: () => void;
|
|
63
|
+
/** Judges what stands at a name, through a path that reaches it, saying it by its shown place. */
|
|
64
|
+
standing_judge: (target: string, shown: string) => void;
|
|
65
|
+
/** Writes a stream through a handle, honouring the cancel and the byte counter. */
|
|
66
|
+
stream_write: (handle: FileHandle) => Promise<number>;
|
|
67
|
+
/** Makes the error for a publication that could not be confirmed. */
|
|
68
|
+
unconfirmed_make: (message: string) => Error;
|
|
69
|
+
/** The temporary file's name. */
|
|
70
|
+
temporary: string;
|
|
71
|
+
/** Whether the write was cancelled. */
|
|
72
|
+
cancel_read: () => boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Whether folders can be held here: Linux, with `/proc` a real procfs that names a held `/` as `/`.
|
|
76
|
+
*
|
|
77
|
+
* @returns True when the held writer is used.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* if (heldFolders_available()) placedFile_write(placed, stream, { mode: 0o600 });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function heldFolders_available(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Judges the probe: `/proc/self/fd` is procfs, and a held `/` reads back as `/` with the same identity through it.
|
|
87
|
+
*
|
|
88
|
+
* @param type - The filesystem type of `/proc/self/fd`.
|
|
89
|
+
* @param link - What the held `/` reads as through it.
|
|
90
|
+
* @param held - The held `/` itself.
|
|
91
|
+
* @param through - The held `/` as reached through `/proc/self/fd/<fd>`.
|
|
92
|
+
* @returns True when folders can be held.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* heldProbe_judge(0x9fa0, '/', held, through); // true when the identities match
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function heldProbe_judge(type: number | bigint, link: string, held: BigIntStats, through: BigIntStats): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Makes a placed folder through held folders, and proves it stands at its place.
|
|
102
|
+
*
|
|
103
|
+
* @param root - The root.
|
|
104
|
+
* @param parts - The folder's parts.
|
|
105
|
+
* @param shared - The shared checks.
|
|
106
|
+
* @throws {Error} When a part cannot be made or held, or the folder is not at its place.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* heldFolder_make(root, ['anat', 'run1'], { root_prove });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare function heldFolder_make(root: HeldRoot, parts: readonly string[], shared: Pick<HeldShared, 'root_prove'>): void;
|
|
114
|
+
/**
|
|
115
|
+
* Writes a placed file through its held folder: a temporary file made there, pinned, written, closed, checked
|
|
116
|
+
* where it stands, and renamed over the name within the same folder (the commit point), then proved.
|
|
117
|
+
*
|
|
118
|
+
* @param root - The root.
|
|
119
|
+
* @param parts - The file's parts (its folder's, then its name).
|
|
120
|
+
* @param mode - The final mode, already checked.
|
|
121
|
+
* @param shared - The shared checks and the stream.
|
|
122
|
+
* @returns The bytes written.
|
|
123
|
+
* @throws {Error} When the write is refused or fails before the commit; an `UnconfirmedPublication` after it.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* const written: number = await heldFile_write(root, ['anat', 't1.nii'], 0o600, shared);
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function heldFile_write(root: HeldRoot, parts: readonly string[], mode: number, shared: HeldShared): Promise<number>;
|