@hadoku/host-wire 0.1.240 → 0.1.242
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/files.d.ts +9 -1
- package/dist/files.js +9 -2
- package/package.json +2 -2
package/dist/files.d.ts
CHANGED
|
@@ -17,5 +17,13 @@ export declare function run(cmd: string, args: string[], opts?: {
|
|
|
17
17
|
* flushed to disk, then renamed over it. `writeFileSync` in place truncates first, so a full disk
|
|
18
18
|
* left a match's `jvm.json` empty and the match un-re-attachable; here a failed write leaves the
|
|
19
19
|
* old file as it was, removes the temporary one, and throws.
|
|
20
|
+
*
|
|
21
|
+
* `durable: false` skips the flush, and is for a record whose every reader dies with the machine:
|
|
22
|
+
* one that names running processes (a JVM's `jvm.json`, its `launch.json`) is read only to take
|
|
23
|
+
* them back, and a process exit, which keeps the page cache, is the only crash it has to survive.
|
|
24
|
+
* The rename is atomic either way. The flush is an `fsyncSync` on the caller's event loop: on a
|
|
25
|
+
* stalled disk it holds everything else that loop does, for nothing such a reader could use.
|
|
20
26
|
*/
|
|
21
|
-
export declare function writeFileAtomicSync(file: string, text: string
|
|
27
|
+
export declare function writeFileAtomicSync(file: string, text: string, opts?: {
|
|
28
|
+
durable?: boolean;
|
|
29
|
+
}): void;
|
package/dist/files.js
CHANGED
|
@@ -30,14 +30,21 @@ export function run(cmd, args, opts = {}) {
|
|
|
30
30
|
* flushed to disk, then renamed over it. `writeFileSync` in place truncates first, so a full disk
|
|
31
31
|
* left a match's `jvm.json` empty and the match un-re-attachable; here a failed write leaves the
|
|
32
32
|
* old file as it was, removes the temporary one, and throws.
|
|
33
|
+
*
|
|
34
|
+
* `durable: false` skips the flush, and is for a record whose every reader dies with the machine:
|
|
35
|
+
* one that names running processes (a JVM's `jvm.json`, its `launch.json`) is read only to take
|
|
36
|
+
* them back, and a process exit, which keeps the page cache, is the only crash it has to survive.
|
|
37
|
+
* The rename is atomic either way. The flush is an `fsyncSync` on the caller's event loop: on a
|
|
38
|
+
* stalled disk it holds everything else that loop does, for nothing such a reader could use.
|
|
33
39
|
*/
|
|
34
|
-
export function writeFileAtomicSync(file, text) {
|
|
40
|
+
export function writeFileAtomicSync(file, text, opts = {}) {
|
|
35
41
|
const tmp = `${file}.tmp-${process.pid}`;
|
|
36
42
|
try {
|
|
37
43
|
const fd = openSync(tmp, 'w');
|
|
38
44
|
try {
|
|
39
45
|
writeFileSync(fd, text);
|
|
40
|
-
|
|
46
|
+
if (opts.durable !== false)
|
|
47
|
+
fsyncSync(fd);
|
|
41
48
|
}
|
|
42
49
|
finally {
|
|
43
50
|
closeSync(fd);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/host-wire",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.242",
|
|
4
|
+
"gitHead": "4d9e52c11dca91edfe373e16a58e49a4ea06df5b",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "The signed wire between a match host and the agent on a hosting claw: request signing, the relay's frames, the messages each side sends, artifact hashes and slice sizing. Knows no game. MIT; imports only node builtins, because the agent bundles it for node 22.",
|