@zukhruf/mutex 0.3.16 → 0.3.17
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 +7 -8
- package/dist/index.d.ts +3 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/lock-stores/file-system/file-lock-store.d.ts +4 -9
- package/dist/lock-stores/file-system/file-lock-store.d.ts.map +1 -1
- package/dist/lock-stores/file-system/file-lock-store.js +21 -38
- package/dist/lock-stores/file-system/file-lock-store.js.map +1 -1
- package/dist/lock-stores/file-system/lock-file-store.d.ts +1 -1
- package/dist/lock-stores/file-system/lock-file-store.d.ts.map +1 -1
- package/dist/lock-stores/file-system/lock-file-store.js +15 -24
- package/dist/lock-stores/file-system/lock-file-store.js.map +1 -1
- package/dist/lock-stores/file-system/presence.d.ts +10 -17
- package/dist/lock-stores/file-system/presence.d.ts.map +1 -1
- package/dist/lock-stores/file-system/presence.js +30 -69
- package/dist/lock-stores/file-system/presence.js.map +1 -1
- package/dist/lock-stores/file-system/record-file.d.ts +10 -0
- package/dist/lock-stores/file-system/record-file.d.ts.map +1 -0
- package/dist/lock-stores/file-system/record-file.js +21 -0
- package/dist/lock-stores/file-system/record-file.js.map +1 -0
- package/dist/lock-stores/file-system/ticket-queue-file-store.d.ts +1 -1
- package/dist/lock-stores/file-system/ticket-queue-file-store.d.ts.map +1 -1
- package/dist/lock-stores/file-system/ticket-queue-file-store.js +25 -32
- package/dist/lock-stores/file-system/ticket-queue-file-store.js.map +1 -1
- package/dist/lock-stores/ipc/child-process-connection.d.ts +3 -4
- package/dist/lock-stores/ipc/child-process-connection.d.ts.map +1 -1
- package/dist/lock-stores/ipc/child-process-connection.js +11 -27
- package/dist/lock-stores/ipc/child-process-connection.js.map +1 -1
- package/dist/lock-stores/ipc/ipc-lock-coordinator.d.ts +3 -7
- package/dist/lock-stores/ipc/ipc-lock-coordinator.d.ts.map +1 -1
- package/dist/lock-stores/ipc/ipc-lock-coordinator.js +6 -12
- package/dist/lock-stores/ipc/ipc-lock-coordinator.js.map +1 -1
- package/dist/lock-stores/ipc/ipc-store.d.ts +2 -7
- package/dist/lock-stores/ipc/ipc-store.d.ts.map +1 -1
- package/dist/lock-stores/ipc/ipc-store.js +9 -15
- package/dist/lock-stores/ipc/ipc-store.js.map +1 -1
- package/dist/lock-stores/ipc/process-channel-connection.d.ts +4 -4
- package/dist/lock-stores/ipc/process-channel-connection.d.ts.map +1 -1
- package/dist/lock-stores/ipc/process-channel-connection.js +13 -25
- package/dist/lock-stores/ipc/process-channel-connection.js.map +1 -1
- package/dist/lock-stores/memory/memory-store.d.ts +1 -1
- package/dist/lock-stores/memory/memory-store.d.ts.map +1 -1
- package/dist/lock-stores/memory/memory-store.js +1 -1
- package/dist/lock-stores/memory/memory-store.js.map +1 -1
- package/dist/lock-stores/remote/connection-supervisor.d.ts +4 -4
- package/dist/lock-stores/remote/connection-supervisor.d.ts.map +1 -1
- package/dist/lock-stores/remote/connection-supervisor.js.map +1 -1
- package/dist/lock-stores/remote/connection.d.ts +4 -3
- package/dist/lock-stores/remote/connection.d.ts.map +1 -1
- package/dist/lock-stores/remote/connector.d.ts +5 -5
- package/dist/lock-stores/remote/connector.d.ts.map +1 -1
- package/dist/lock-stores/remote/delegating-lock-store.d.ts +14 -0
- package/dist/lock-stores/remote/delegating-lock-store.d.ts.map +1 -0
- package/dist/lock-stores/remote/delegating-lock-store.js +20 -0
- package/dist/lock-stores/remote/delegating-lock-store.js.map +1 -0
- package/dist/lock-stores/remote/lock-coordinator.d.ts +3 -4
- package/dist/lock-stores/remote/lock-coordinator.d.ts.map +1 -1
- package/dist/lock-stores/remote/lock-coordinator.js +23 -12
- package/dist/lock-stores/remote/lock-coordinator.js.map +1 -1
- package/dist/lock-stores/remote/protocol.d.ts +6 -2
- package/dist/lock-stores/remote/protocol.d.ts.map +1 -1
- package/dist/lock-stores/remote/protocol.js +14 -8
- package/dist/lock-stores/remote/protocol.js.map +1 -1
- package/dist/lock-stores/remote/queries.d.ts +2 -2
- package/dist/lock-stores/remote/queries.d.ts.map +1 -1
- package/dist/lock-stores/remote/queries.js.map +1 -1
- package/dist/lock-stores/remote/remote-lock-client.d.ts +2 -2
- package/dist/lock-stores/remote/remote-lock-client.d.ts.map +1 -1
- package/dist/lock-stores/remote/remote-lock-client.js +15 -8
- package/dist/lock-stores/remote/remote-lock-client.js.map +1 -1
- package/dist/lock-stores/remote/shared-channel-connection.d.ts +27 -0
- package/dist/lock-stores/remote/shared-channel-connection.d.ts.map +1 -0
- package/dist/lock-stores/remote/shared-channel-connection.js +41 -0
- package/dist/lock-stores/remote/shared-channel-connection.js.map +1 -0
- package/dist/lock-stores/socket/advertised-ops-connection.d.ts +3 -3
- package/dist/lock-stores/socket/advertised-ops-connection.d.ts.map +1 -1
- package/dist/lock-stores/socket/advertised-ops-connection.js +4 -1
- package/dist/lock-stores/socket/advertised-ops-connection.js.map +1 -1
- package/dist/lock-stores/socket/electing-connector.d.ts +4 -5
- package/dist/lock-stores/socket/electing-connector.d.ts.map +1 -1
- package/dist/lock-stores/socket/electing-connector.js +43 -50
- package/dist/lock-stores/socket/electing-connector.js.map +1 -1
- package/dist/lock-stores/socket/handshake.d.ts.map +1 -1
- package/dist/lock-stores/socket/handshake.js +6 -5
- package/dist/lock-stores/socket/handshake.js.map +1 -1
- package/dist/lock-stores/socket/json-line.d.ts +6 -0
- package/dist/lock-stores/socket/json-line.d.ts.map +1 -0
- package/dist/lock-stores/socket/json-line.js +8 -0
- package/dist/lock-stores/socket/json-line.js.map +1 -0
- package/dist/lock-stores/socket/leave-errors-to-close.d.ts +9 -0
- package/dist/lock-stores/socket/leave-errors-to-close.d.ts.map +1 -0
- package/dist/lock-stores/socket/leave-errors-to-close.js +10 -0
- package/dist/lock-stores/socket/leave-errors-to-close.js.map +1 -0
- package/dist/lock-stores/socket/local-directory-connector.d.ts.map +1 -1
- package/dist/lock-stores/socket/local-directory-connector.js +1 -1
- package/dist/lock-stores/socket/local-directory-connector.js.map +1 -1
- package/dist/lock-stores/socket/lock-server.d.ts +7 -4
- package/dist/lock-stores/socket/lock-server.d.ts.map +1 -1
- package/dist/lock-stores/socket/lock-server.js +29 -26
- package/dist/lock-stores/socket/lock-server.js.map +1 -1
- package/dist/lock-stores/socket/socket-connection.d.ts +5 -5
- package/dist/lock-stores/socket/socket-connection.d.ts.map +1 -1
- package/dist/lock-stores/socket/socket-connection.js +18 -23
- package/dist/lock-stores/socket/socket-connection.js.map +1 -1
- package/dist/lock-stores/socket/socket-election.d.ts +9 -0
- package/dist/lock-stores/socket/socket-election.d.ts.map +1 -0
- package/dist/lock-stores/socket/socket-election.js +16 -0
- package/dist/lock-stores/socket/socket-election.js.map +1 -0
- package/dist/lock-stores/socket/socket-store.d.ts +1 -1
- package/dist/lock-stores/socket/socket-store.d.ts.map +1 -1
- package/dist/lock-stores/socket/socket-store.js +6 -6
- package/dist/lock-stores/socket/socket-store.js.map +1 -1
- package/dist/lock-stores/sqlite/holder-record.d.ts.map +1 -1
- package/dist/lock-stores/sqlite/holder-record.js +9 -23
- package/dist/lock-stores/sqlite/holder-record.js.map +1 -1
- package/dist/lock-stores/sqlite/sqlite-store.d.ts +6 -7
- package/dist/lock-stores/sqlite/sqlite-store.d.ts.map +1 -1
- package/dist/lock-stores/sqlite/sqlite-store.js +31 -101
- package/dist/lock-stores/sqlite/sqlite-store.js.map +1 -1
- package/dist/lock-stores/thread/parent-port-connection.d.ts +3 -4
- package/dist/lock-stores/thread/parent-port-connection.d.ts.map +1 -1
- package/dist/lock-stores/thread/parent-port-connection.js +7 -13
- package/dist/lock-stores/thread/parent-port-connection.js.map +1 -1
- package/dist/lock-stores/thread/thread-lock-coordinator.d.ts +3 -7
- package/dist/lock-stores/thread/thread-lock-coordinator.d.ts.map +1 -1
- package/dist/lock-stores/thread/thread-lock-coordinator.js +6 -12
- package/dist/lock-stores/thread/thread-lock-coordinator.js.map +1 -1
- package/dist/lock-stores/thread/thread-store.d.ts +2 -7
- package/dist/lock-stores/thread/thread-store.d.ts.map +1 -1
- package/dist/lock-stores/thread/thread-store.js +3 -12
- package/dist/lock-stores/thread/thread-store.js.map +1 -1
- package/dist/lock-stores/thread/worker-connection.d.ts +3 -4
- package/dist/lock-stores/thread/worker-connection.d.ts.map +1 -1
- package/dist/lock-stores/thread/worker-connection.js +6 -18
- package/dist/lock-stores/thread/worker-connection.js.map +1 -1
- package/dist/mutex/key.d.ts +3 -3
- package/dist/mutex/key.d.ts.map +1 -1
- package/dist/mutex/key.js.map +1 -1
- package/dist/mutex/lease.d.ts +2 -9
- package/dist/mutex/lease.d.ts.map +1 -1
- package/dist/mutex/lease.js +17 -12
- package/dist/mutex/lease.js.map +1 -1
- package/dist/mutex/mutex.d.ts +3 -3
- package/dist/mutex/mutex.d.ts.map +1 -1
- package/dist/mutex/mutex.js +2 -2
- package/dist/mutex/mutex.js.map +1 -1
- package/package.json +6 -9
- package/dist/fencing/counter-token-source.d.ts +0 -11
- package/dist/fencing/counter-token-source.d.ts.map +0 -1
- package/dist/fencing/counter-token-source.js +0 -13
- package/dist/fencing/counter-token-source.js.map +0 -1
- package/dist/fencing/epoch-token-source.d.ts +0 -13
- package/dist/fencing/epoch-token-source.d.ts.map +0 -1
- package/dist/fencing/epoch-token-source.js +0 -27
- package/dist/fencing/epoch-token-source.js.map +0 -1
- package/dist/fencing/fencing-token.d.ts +0 -12
- package/dist/fencing/fencing-token.d.ts.map +0 -1
- package/dist/fencing/fencing-token.js +0 -18
- package/dist/fencing/fencing-token.js.map +0 -1
- package/dist/fencing/file-token-source.d.ts +0 -13
- package/dist/fencing/file-token-source.d.ts.map +0 -1
- package/dist/fencing/file-token-source.js +0 -36
- package/dist/fencing/file-token-source.js.map +0 -1
- package/dist/fencing/monotonic-clock-token-source.d.ts +0 -12
- package/dist/fencing/monotonic-clock-token-source.d.ts.map +0 -1
- package/dist/fencing/monotonic-clock-token-source.js +0 -15
- package/dist/fencing/monotonic-clock-token-source.js.map +0 -1
- package/dist/fencing/token-source.d.ts +0 -9
- package/dist/fencing/token-source.d.ts.map +0 -1
- package/dist/fencing/token-source.js +0 -2
- package/dist/fencing/token-source.js.map +0 -1
- package/dist/leader-election/index.d.ts +0 -4
- package/dist/leader-election/index.d.ts.map +0 -1
- package/dist/leader-election/index.js +0 -4
- package/dist/leader-election/index.js.map +0 -1
- package/dist/leader-election/leader-election.d.ts +0 -23
- package/dist/leader-election/leader-election.d.ts.map +0 -1
- package/dist/leader-election/leader-election.js +0 -79
- package/dist/leader-election/leader-election.js.map +0 -1
- package/dist/leader-election/leadership.d.ts +0 -14
- package/dist/leader-election/leadership.d.ts.map +0 -1
- package/dist/leader-election/leadership.js +0 -23
- package/dist/leader-election/leadership.js.map +0 -1
- package/dist/local-directory/local-directory.d.ts +0 -7
- package/dist/local-directory/local-directory.d.ts.map +0 -1
- package/dist/local-directory/local-directory.js +0 -75
- package/dist/local-directory/local-directory.js.map +0 -1
- package/dist/local-directory/network-directory-error.d.ts +0 -8
- package/dist/local-directory/network-directory-error.d.ts.map +0 -1
- package/dist/local-directory/network-directory-error.js +0 -13
- package/dist/local-directory/network-directory-error.js.map +0 -1
- package/dist/mutex/lock-lost-error.d.ts +0 -6
- package/dist/mutex/lock-lost-error.d.ts.map +0 -1
- package/dist/mutex/lock-lost-error.js +0 -10
- package/dist/mutex/lock-lost-error.js.map +0 -1
- package/dist/shared/fs/atomic-write.d.ts +0 -3
- package/dist/shared/fs/atomic-write.d.ts.map +0 -1
- package/dist/shared/fs/atomic-write.js +0 -10
- package/dist/shared/fs/atomic-write.js.map +0 -1
- package/dist/shared/fs/create-exclusive.d.ts +0 -6
- package/dist/shared/fs/create-exclusive.d.ts.map +0 -1
- package/dist/shared/fs/create-exclusive.js +0 -29
- package/dist/shared/fs/create-exclusive.js.map +0 -1
- package/dist/shared/fs/durable-write.d.ts +0 -9
- package/dist/shared/fs/durable-write.d.ts.map +0 -1
- package/dist/shared/fs/durable-write.js +0 -49
- package/dist/shared/fs/durable-write.js.map +0 -1
- package/dist/shared/fs/errno.d.ts +0 -2
- package/dist/shared/fs/errno.d.ts.map +0 -1
- package/dist/shared/fs/errno.js +0 -4
- package/dist/shared/fs/errno.js.map +0 -1
- package/dist/shared/fs/patiently.d.ts +0 -3
- package/dist/shared/fs/patiently.d.ts.map +0 -1
- package/dist/shared/fs/patiently.js +0 -30
- package/dist/shared/fs/patiently.js.map +0 -1
- package/dist/shared/fs/replace-file.d.ts +0 -8
- package/dist/shared/fs/replace-file.d.ts.map +0 -1
- package/dist/shared/fs/replace-file.js +0 -12
- package/dist/shared/fs/replace-file.js.map +0 -1
- package/dist/shared/fs/safe-file-name.d.ts +0 -16
- package/dist/shared/fs/safe-file-name.d.ts.map +0 -1
- package/dist/shared/fs/safe-file-name.js +0 -37
- package/dist/shared/fs/safe-file-name.js.map +0 -1
- package/dist/shared/sqlite/is-busy.d.ts +0 -3
- package/dist/shared/sqlite/is-busy.d.ts.map +0 -1
- package/dist/shared/sqlite/is-busy.js +0 -10
- package/dist/shared/sqlite/is-busy.js.map +0 -1
- package/dist/shared/sqlite/is-cant-open.d.ts +0 -3
- package/dist/shared/sqlite/is-cant-open.d.ts.map +0 -1
- package/dist/shared/sqlite/is-cant-open.js +0 -9
- package/dist/shared/sqlite/is-cant-open.js.map +0 -1
- package/dist/shared/sqlite/is-not-a-database.d.ts +0 -3
- package/dist/shared/sqlite/is-not-a-database.d.ts.map +0 -1
- package/dist/shared/sqlite/is-not-a-database.js +0 -9
- package/dist/shared/sqlite/is-not-a-database.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../../../src/lock-stores/file-system/presence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../../../src/lock-stores/file-system/presence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;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CAAC,MAAc,EAAE,IAAY;QACzC,OAAO,IAAI,KAAK,CACd,mBAAmB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,yCAAyC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,+JAA+J,CACtQ,CAAC;IACJ,CAAC;IAED,uFAAuF;IACvF,GAAG;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,YAAiC;QAClD,IAAI,CAAC;YACH,MAAM,YAAY,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,MAAM,KAAK,CAAC;QACd,CAAC;QACD,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,uEAAuE;IACvE,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text of the caller record at `path`, or `undefined` when there is none.
|
|
3
|
+
*
|
|
4
|
+
* Windows cannot replace a file while another handle has it open, so a
|
|
5
|
+
* rename that replaces a record fails while waiters read it. A synchronous
|
|
6
|
+
* read opens and closes the file in one call; the asynchronous read of
|
|
7
|
+
* Node.js 24 keeps it open across several turns of the event loop.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readRecord(path: string): Promise<string | undefined>;
|
|
10
|
+
//# sourceMappingURL=record-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-file.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/file-system/record-file.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO1E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { isErrno, patiently } from '@zukhruf/fs';
|
|
3
|
+
/**
|
|
4
|
+
* The text of the caller record at `path`, or `undefined` when there is none.
|
|
5
|
+
*
|
|
6
|
+
* Windows cannot replace a file while another handle has it open, so a
|
|
7
|
+
* rename that replaces a record fails while waiters read it. A synchronous
|
|
8
|
+
* read opens and closes the file in one call; the asynchronous read of
|
|
9
|
+
* Node.js 24 keeps it open across several turns of the event loop.
|
|
10
|
+
*/
|
|
11
|
+
export async function readRecord(path) {
|
|
12
|
+
try {
|
|
13
|
+
return await patiently(async () => readFileSync(path, 'utf8'));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (isErrno(error, 'ENOENT'))
|
|
17
|
+
return undefined;
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=record-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-file.js","sourceRoot":"","sources":["../../../src/lock-stores/file-system/record-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,IAAI,CAAC;QACH,OAAO,MAAM,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;YAAE,OAAO,SAAS,CAAC;QAC/C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { FileLockStore } from './file-lock-store.ts';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class TicketQueueFileStore extends FileLockStore {
|
|
12
12
|
#private;
|
|
13
|
-
/**
|
|
13
|
+
/** The longer of a presence file and the draft that `atomicWrite` writes beside the record. */
|
|
14
14
|
protected readonly longestSuffix: number;
|
|
15
15
|
protected lock(path: string, signal: AbortSignal | undefined): Promise<AsyncDisposable>;
|
|
16
16
|
protected tryLock(path: string): Promise<AsyncDisposable | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticket-queue-file-store.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/file-system/ticket-queue-file-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ticket-queue-file-store.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/file-system/ticket-queue-file-store.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;;IACrD,+FAA+F;IAC/F,SAAS,CAAC,QAAQ,CAAC,aAAa,SAG9B;cAEc,IAAI,CAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,eAAe,CAAC;cAWX,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAgB3E,8GAA8G;IAC9G,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAuCnD"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
1
|
import { appendFile } from 'node:fs/promises';
|
|
3
|
-
import { atomicWrite } from
|
|
4
|
-
import { isErrno } from "../../shared/fs/errno.js";
|
|
5
|
-
import { patiently } from "../../shared/fs/patiently.js";
|
|
2
|
+
import { atomicWrite, draftSuffixLength, patiently } from '@zukhruf/fs';
|
|
6
3
|
import { Caller } from "./caller.js";
|
|
7
4
|
import { FileLockStore } from "./file-lock-store.js";
|
|
8
5
|
import { Presence } from "./presence.js";
|
|
6
|
+
import { readRecord } from "./record-file.js";
|
|
9
7
|
/**
|
|
10
8
|
* FIFO queue in one file: each waiter appends its ticket line and holds the
|
|
11
9
|
* lock once its ticket is first.
|
|
@@ -16,39 +14,38 @@ import { Presence } from "./presence.js";
|
|
|
16
14
|
* its waiter notices and appends it again.
|
|
17
15
|
*/
|
|
18
16
|
export class TicketQueueFileStore extends FileLockStore {
|
|
19
|
-
/**
|
|
20
|
-
longestSuffix = Presence.suffixLength;
|
|
17
|
+
/** The longer of a presence file and the draft that `atomicWrite` writes beside the record. */
|
|
18
|
+
longestSuffix = Math.max(Presence.suffixLength, draftSuffixLength);
|
|
21
19
|
async lock(path, signal) {
|
|
22
20
|
const me = Caller.current();
|
|
23
21
|
await using leaving = new AsyncDisposableStack();
|
|
24
|
-
const presence = Presence.claim(
|
|
22
|
+
const presence = Presence.claim(path, me);
|
|
25
23
|
leaving.defer(() => leave(path, me, presence));
|
|
26
24
|
await enqueue(path, me);
|
|
27
|
-
await this.poll(() => this.#attempt(path, me),
|
|
25
|
+
await this.poll(() => this.#attempt(path, me), signal);
|
|
28
26
|
leaving.move();
|
|
29
27
|
return holding(path, me, presence);
|
|
30
28
|
}
|
|
31
29
|
async tryLock(path) {
|
|
32
|
-
const
|
|
30
|
+
const head = await readHead(path);
|
|
33
31
|
if (head)
|
|
34
32
|
await this.#evictGoneHeads(path, head);
|
|
35
33
|
if ((await readTickets(path)).length > 0)
|
|
36
34
|
return undefined;
|
|
37
35
|
const me = Caller.current();
|
|
38
36
|
await using leaving = new AsyncDisposableStack();
|
|
39
|
-
const presence = Presence.claim(
|
|
37
|
+
const presence = Presence.claim(path, me);
|
|
40
38
|
leaving.defer(() => leave(path, me, presence));
|
|
41
39
|
await enqueue(path, me);
|
|
42
|
-
const [first] = await readTickets(path);
|
|
43
40
|
// Another waiter appended at the same moment and is first.
|
|
44
|
-
if (
|
|
41
|
+
if ((await readHead(path))?.id !== me.id)
|
|
45
42
|
return undefined;
|
|
46
43
|
leaving.move();
|
|
47
44
|
return holding(path, me, presence);
|
|
48
45
|
}
|
|
49
46
|
/** The first ticket's caller holds the key. A gone one does not, and a waiter behind it holds nothing yet. */
|
|
50
47
|
isHeldAt(path) {
|
|
51
|
-
return Presence.isNamedCallerPresent(path,
|
|
48
|
+
return Presence.isNamedCallerPresent(path, () => readHead(path));
|
|
52
49
|
}
|
|
53
50
|
async #attempt(path, me) {
|
|
54
51
|
const tickets = await readTickets(path);
|
|
@@ -91,7 +88,7 @@ export class TicketQueueFileStore extends FileLockStore {
|
|
|
91
88
|
}
|
|
92
89
|
/** Whether the caller at the head of the queue at `path` no longer runs. */
|
|
93
90
|
async function isGone(path, head) {
|
|
94
|
-
const state = await Presence.judge(path, head,
|
|
91
|
+
const state = await Presence.judge(path, head, () => readHead(path));
|
|
95
92
|
return state === 'gone';
|
|
96
93
|
}
|
|
97
94
|
/**
|
|
@@ -100,10 +97,10 @@ async function isGone(path, head) {
|
|
|
100
97
|
* it first evicts it, together with the presence file.
|
|
101
98
|
*/
|
|
102
99
|
async function leave(path, me, presence) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
using reading = new DisposableStack();
|
|
101
|
+
reading.defer(() => presence.end());
|
|
102
|
+
const tickets = await readTickets(path);
|
|
103
|
+
reading.move();
|
|
107
104
|
if (tickets.some((ticket) => ticket.id === me.id))
|
|
108
105
|
presence.end();
|
|
109
106
|
else
|
|
@@ -121,21 +118,17 @@ async function removeTicket(path, me) {
|
|
|
121
118
|
async function enqueue(path, caller) {
|
|
122
119
|
await patiently(() => appendFile(path, `${caller.serialize()}\n`));
|
|
123
120
|
}
|
|
121
|
+
/** The caller of the first ticket, which holds the key while it runs. */
|
|
122
|
+
async function readHead(path) {
|
|
123
|
+
const [head] = await readTickets(path);
|
|
124
|
+
return head;
|
|
125
|
+
}
|
|
124
126
|
async function readTickets(path) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const content = await patiently(async () => readFileSync(path, 'utf8'));
|
|
131
|
-
// The last segment is empty or a ticket still being appended.
|
|
132
|
-
return content.split('\n').slice(0, -1).map(Caller.parse);
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
if (isErrno(error, 'ENOENT'))
|
|
136
|
-
return [];
|
|
137
|
-
throw error;
|
|
138
|
-
}
|
|
127
|
+
const content = await readRecord(path);
|
|
128
|
+
if (content === undefined)
|
|
129
|
+
return [];
|
|
130
|
+
// The last segment is empty or a ticket still being appended.
|
|
131
|
+
return content.split('\n').slice(0, -1).map(Caller.parse);
|
|
139
132
|
}
|
|
140
133
|
async function replace(path, tickets) {
|
|
141
134
|
await atomicWrite(path, tickets.map((ticket) => `${ticket.serialize()}\n`).join(''));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticket-queue-file-store.js","sourceRoot":"","sources":["../../../src/lock-stores/file-system/ticket-queue-file-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ticket-queue-file-store.js","sourceRoot":"","sources":["../../../src/lock-stores/file-system/ticket-queue-file-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU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,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,IAAY;IACrC,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrC,8DAA8D;IAC9D,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,OAAiB;IACpD,MAAM,WAAW,CACf,IAAI,EACJ,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { type LockResponse, type RequestEnvelope } from '../remote/protocol.ts';
|
|
2
|
+
import type { LockResponse } from '../remote/protocol.ts';
|
|
3
|
+
import { SharedChannelConnection } from '../remote/shared-channel-connection.ts';
|
|
5
4
|
/**
|
|
6
5
|
* The parent's end of the IPC channel to one child. The kernel closes the
|
|
7
6
|
* channel when the child dies, so `disconnect` reports even a SIGKILL.
|
|
8
7
|
*/
|
|
9
|
-
export declare class ChildProcessConnection extends
|
|
8
|
+
export declare class ChildProcessConnection extends SharedChannelConnection<LockResponse> {
|
|
10
9
|
#private;
|
|
11
10
|
constructor(child: ChildProcess);
|
|
12
11
|
send(response: LockResponse): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-process-connection.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/child-process-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"child-process-connection.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/child-process-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAC;AAIrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,uBAAuB,CAAC,YAAY,CAAC;;gBAInE,KAAK,EAAE,YAAY;IAM/B,IAAI,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,wDAAwD;IACxD,GAAG;IAEH,KAAK;IAEL,KAAK;CAGN"}
|
|
@@ -1,42 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { promisify } from 'node:util';
|
|
2
|
+
import { wrap } from "../remote/envelope.js";
|
|
3
|
+
import { SharedChannelConnection } from "../remote/shared-channel-connection.js";
|
|
4
4
|
/**
|
|
5
5
|
* The parent's end of the IPC channel to one child. The kernel closes the
|
|
6
6
|
* channel when the child dies, so `disconnect` reports even a SIGKILL.
|
|
7
7
|
*/
|
|
8
|
-
export class ChildProcessConnection extends
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
const request = unwrap(envelope);
|
|
12
|
-
if (isRequestEnvelope(request))
|
|
13
|
-
this.emit('message', request);
|
|
14
|
-
};
|
|
15
|
-
#onDisconnect = () => {
|
|
16
|
-
this.close();
|
|
17
|
-
this.emit('close');
|
|
18
|
-
};
|
|
8
|
+
export class ChildProcessConnection extends SharedChannelConnection {
|
|
9
|
+
/** A send after the channel closed reports the error through its callback. */
|
|
10
|
+
#send;
|
|
19
11
|
constructor(child) {
|
|
20
|
-
super();
|
|
21
|
-
this.#
|
|
22
|
-
|
|
23
|
-
child.once('disconnect', this.#onDisconnect);
|
|
12
|
+
super(child, ['disconnect']);
|
|
13
|
+
this.#send = promisify(child.send).bind(child);
|
|
14
|
+
this.listen();
|
|
24
15
|
}
|
|
25
16
|
send(response) {
|
|
26
|
-
return
|
|
27
|
-
if (!this.#child.connected) {
|
|
28
|
-
reject(new Error('The child process has disconnected.'));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.#child.send(wrap(response), (error) => error ? reject(error) : resolve());
|
|
32
|
-
});
|
|
17
|
+
return this.#send(wrap(response));
|
|
33
18
|
}
|
|
34
19
|
/** The running child already keeps the parent alive. */
|
|
35
20
|
ref() { }
|
|
36
21
|
unref() { }
|
|
37
22
|
close() {
|
|
38
|
-
this
|
|
39
|
-
this.#child.off('disconnect', this.#onDisconnect);
|
|
23
|
+
this.stopListening();
|
|
40
24
|
}
|
|
41
25
|
}
|
|
42
26
|
//# sourceMappingURL=child-process-connection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-process-connection.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/child-process-connection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"child-process-connection.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/child-process-connection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,uBAAqC;IAC/E,8EAA8E;IACrE,KAAK,CAA4C;IAE1D,YAAY,KAAmB;QAC7B,KAAK,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAqB,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,QAAsB;QACzB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpC,CAAC;IAED,wDAAwD;IACxD,GAAG,KAAI,CAAC;IAER,KAAK,KAAI,CAAC;IAEV,KAAK;QACH,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
|
-
import type
|
|
3
|
-
import
|
|
4
|
-
import type { AcquireOptions, LockStore } from '../../mutex/lock-store.ts';
|
|
2
|
+
import { type TokenSource } from '@zukhruf/fencing';
|
|
3
|
+
import { DelegatingLockStore } from '../remote/delegating-lock-store.ts';
|
|
5
4
|
export interface IpcLockCoordinatorOptions {
|
|
6
5
|
/** Defaults to an in-memory counter, which lives as long as this process. */
|
|
7
6
|
tokens?: TokenSource;
|
|
@@ -10,12 +9,9 @@ export interface IpcLockCoordinatorOptions {
|
|
|
10
9
|
* The parent side of IPC locking: grants keys to this process and to every
|
|
11
10
|
* child it adopts, which use `IpcStore`. Its reach is one process tree.
|
|
12
11
|
*/
|
|
13
|
-
export declare class IpcLockCoordinator
|
|
12
|
+
export declare class IpcLockCoordinator extends DelegatingLockStore {
|
|
14
13
|
#private;
|
|
15
14
|
constructor({ tokens, }?: IpcLockCoordinatorOptions);
|
|
16
|
-
acquire(key: string, options?: AcquireOptions): Promise<LockHandle>;
|
|
17
|
-
tryAcquire(key: string): Promise<LockHandle | undefined>;
|
|
18
|
-
isHeld(key: string): Promise<boolean>;
|
|
19
15
|
/**
|
|
20
16
|
* Serves `child`, which must have an IPC channel. When the child exits,
|
|
21
17
|
* everything it held or waited for is released.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipc-lock-coordinator.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-lock-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ipc-lock-coordinator.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-lock-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAIzE,MAAM,WAAW,yBAAyB;IACxC,6EAA6E;IAC7E,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB;;gBAG7C,EACV,MAAiC,GAClC,GAAE,yBAA8B;IAMjC;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,YAAY;CAG1B"}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import { CounterTokenSource } from
|
|
1
|
+
import { CounterTokenSource } from '@zukhruf/fencing';
|
|
2
|
+
import { DelegatingLockStore } from "../remote/delegating-lock-store.js";
|
|
2
3
|
import { LockCoordinator } from "../remote/lock-coordinator.js";
|
|
3
4
|
import { ChildProcessConnection } from "./child-process-connection.js";
|
|
4
5
|
/**
|
|
5
6
|
* The parent side of IPC locking: grants keys to this process and to every
|
|
6
7
|
* child it adopts, which use `IpcStore`. Its reach is one process tree.
|
|
7
8
|
*/
|
|
8
|
-
export class IpcLockCoordinator {
|
|
9
|
+
export class IpcLockCoordinator extends DelegatingLockStore {
|
|
9
10
|
#coordinator;
|
|
10
11
|
constructor({ tokens = new CounterTokenSource(), } = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return this.#coordinator.acquire(key, options);
|
|
15
|
-
}
|
|
16
|
-
tryAcquire(key) {
|
|
17
|
-
return this.#coordinator.tryAcquire(key);
|
|
18
|
-
}
|
|
19
|
-
isHeld(key) {
|
|
20
|
-
return this.#coordinator.isHeld(key);
|
|
12
|
+
const coordinator = new LockCoordinator({ tokens });
|
|
13
|
+
super(coordinator);
|
|
14
|
+
this.#coordinator = coordinator;
|
|
21
15
|
}
|
|
22
16
|
/**
|
|
23
17
|
* Serves `child`, which must have an IPC channel. When the child exits,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipc-lock-coordinator.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-lock-coordinator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ipc-lock-coordinator.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-lock-coordinator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAOvE;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,mBAAmB;IAChD,YAAY,CAAkB;IAEvC,YAAY,EACV,MAAM,GAAG,IAAI,kBAAkB,EAAE,MACJ,EAAE;QAC/B,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACpD,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAmB;QACvB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { AcquireOptions, LockStore } from '../../mutex/lock-store.ts';
|
|
1
|
+
import { DelegatingLockStore } from '../remote/delegating-lock-store.ts';
|
|
3
2
|
/**
|
|
4
3
|
* The child-process side of `IpcLockCoordinator`: asks the parent for keys over
|
|
5
4
|
* the IPC channel. If the parent dies, waiting acquires reject with
|
|
6
5
|
* `CoordinatorUnavailableError`; held keys stay exclusive, because no
|
|
7
6
|
* coordinator is left to grant them to anyone else.
|
|
8
7
|
*/
|
|
9
|
-
export declare class IpcStore
|
|
10
|
-
#private;
|
|
8
|
+
export declare class IpcStore extends DelegatingLockStore {
|
|
11
9
|
constructor();
|
|
12
|
-
acquire(key: string, options?: AcquireOptions): Promise<LockHandle>;
|
|
13
|
-
tryAcquire(key: string): Promise<LockHandle | undefined>;
|
|
14
|
-
isHeld(key: string): Promise<boolean>;
|
|
15
10
|
}
|
|
16
11
|
//# sourceMappingURL=ipc-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipc-store.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ipc-store.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAkBzE;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,mBAAmB;;CAgBhD"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { promisify } from 'node:util';
|
|
1
2
|
import { ConnectionSupervisor } from "../remote/connection-supervisor.js";
|
|
3
|
+
import { DelegatingLockStore } from "../remote/delegating-lock-store.js";
|
|
2
4
|
import { RemoteLockClient } from "../remote/remote-lock-client.js";
|
|
3
5
|
import { ProcessChannelConnection } from "./process-channel-connection.js";
|
|
4
6
|
/** The channel to the parent cannot be re-established, so it is handed out once. */
|
|
5
7
|
class ProcessChannelConnector {
|
|
6
|
-
#channel
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
#channel;
|
|
9
|
+
constructor(channel) {
|
|
10
|
+
this.#channel = [channel].values();
|
|
11
|
+
}
|
|
9
12
|
async connect() {
|
|
10
13
|
if (!process.connected)
|
|
11
14
|
return undefined;
|
|
@@ -18,22 +21,13 @@ class ProcessChannelConnector {
|
|
|
18
21
|
* `CoordinatorUnavailableError`; held keys stay exclusive, because no
|
|
19
22
|
* coordinator is left to grant them to anyone else.
|
|
20
23
|
*/
|
|
21
|
-
export class IpcStore {
|
|
22
|
-
#client;
|
|
24
|
+
export class IpcStore extends DelegatingLockStore {
|
|
23
25
|
constructor() {
|
|
24
26
|
if (!process.send) {
|
|
25
27
|
throw new Error('IpcStore needs an IPC channel to its parent; start this process with fork() or an "ipc" stdio entry.');
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
acquire(key, options) {
|
|
30
|
-
return this.#client.acquire(key, options);
|
|
31
|
-
}
|
|
32
|
-
tryAcquire(key) {
|
|
33
|
-
return this.#client.tryAcquire(key);
|
|
34
|
-
}
|
|
35
|
-
isHeld(key) {
|
|
36
|
-
return this.#client.isHeld(key);
|
|
29
|
+
const channel = new ProcessChannelConnection(promisify(process.send).bind(process));
|
|
30
|
+
super(new RemoteLockClient(new ConnectionSupervisor(new ProcessChannelConnector(channel))));
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
33
|
//# sourceMappingURL=ipc-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipc-store.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ipc-store.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/ipc-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,oFAAoF;AACpF,MAAM,uBAAuB;IAClB,QAAQ,CAAgD;IAEjE,YAAY,OAAiC;QAC3C,IAAI,CAAC,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,OAAO,CAAC,SAAS;YAAE,OAAO,SAAS,CAAC;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;IACpC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,QAAS,SAAQ,mBAAmB;IAC/C;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,sGAAsG,CACvG,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,wBAAwB,CAC1C,SAAS,CAAgB,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CACrD,CAAC;QACF,KAAK,CACH,IAAI,gBAAgB,CAClB,IAAI,oBAAoB,CAAC,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAC/D,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { type LockRequest, type LockResponse } from '../remote/protocol.ts';
|
|
1
|
+
import type { LockRequest } from '../remote/protocol.ts';
|
|
2
|
+
import { SharedChannelConnection } from '../remote/shared-channel-connection.ts';
|
|
4
3
|
/**
|
|
5
4
|
* The child's end of the IPC channel to its parent. Node counts `message` and
|
|
6
5
|
* `disconnect` listeners to decide whether the channel keeps the process alive,
|
|
@@ -8,8 +7,9 @@ import { type LockRequest, type LockResponse } from '../remote/protocol.ts';
|
|
|
8
7
|
* own listeners in charge of the process lifetime. Messages that arrive while
|
|
9
8
|
* not listening are buffered by Node and delivered on the next `ref`.
|
|
10
9
|
*/
|
|
11
|
-
export declare class ProcessChannelConnection extends
|
|
10
|
+
export declare class ProcessChannelConnection extends SharedChannelConnection<LockRequest> {
|
|
12
11
|
#private;
|
|
12
|
+
constructor(send: (envelope: unknown) => Promise<void>);
|
|
13
13
|
send(request: LockRequest): Promise<void>;
|
|
14
14
|
/** Removes the listeners before it adds them, so a second `ref` does not listen twice. */
|
|
15
15
|
ref(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-channel-connection.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/process-channel-connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-channel-connection.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/ipc/process-channel-connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,uBAAuB,CAAC,WAAW,CAAC;;gBAIpE,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC;IAKtD,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,0FAA0F;IAC1F,GAAG;IAKH,KAAK;IAIL,KAAK;CAGN"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { isLockResponse, } from "../remote/protocol.js";
|
|
1
|
+
import { wrap } from "../remote/envelope.js";
|
|
2
|
+
import { SharedChannelConnection } from "../remote/shared-channel-connection.js";
|
|
4
3
|
/**
|
|
5
4
|
* The child's end of the IPC channel to its parent. Node counts `message` and
|
|
6
5
|
* `disconnect` listeners to decide whether the channel keeps the process alive,
|
|
@@ -8,34 +7,23 @@ import { isLockResponse, } from "../remote/protocol.js";
|
|
|
8
7
|
* own listeners in charge of the process lifetime. Messages that arrive while
|
|
9
8
|
* not listening are buffered by Node and delivered on the next `ref`.
|
|
10
9
|
*/
|
|
11
|
-
export class ProcessChannelConnection extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.unref();
|
|
19
|
-
this.emit('close');
|
|
20
|
-
};
|
|
10
|
+
export class ProcessChannelConnection extends SharedChannelConnection {
|
|
11
|
+
/** `process.send`, which reports a send after the channel closed through its callback. */
|
|
12
|
+
#send;
|
|
13
|
+
constructor(send) {
|
|
14
|
+
super(process, ['disconnect']);
|
|
15
|
+
this.#send = send;
|
|
16
|
+
}
|
|
21
17
|
send(request) {
|
|
22
|
-
return
|
|
23
|
-
if (!process.send || !process.connected) {
|
|
24
|
-
reject(new Error('The IPC channel to the parent is closed.'));
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
process.send(wrap(request), undefined, {}, (error) => error ? reject(error) : resolve());
|
|
28
|
-
});
|
|
18
|
+
return this.#send(wrap(request));
|
|
29
19
|
}
|
|
30
20
|
/** Removes the listeners before it adds them, so a second `ref` does not listen twice. */
|
|
31
21
|
ref() {
|
|
32
|
-
this.
|
|
33
|
-
|
|
34
|
-
process.on('disconnect', this.#onDisconnect);
|
|
22
|
+
this.stopListening();
|
|
23
|
+
this.listen();
|
|
35
24
|
}
|
|
36
25
|
unref() {
|
|
37
|
-
|
|
38
|
-
process.off('disconnect', this.#onDisconnect);
|
|
26
|
+
this.stopListening();
|
|
39
27
|
}
|
|
40
28
|
close() {
|
|
41
29
|
this.unref();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-channel-connection.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/process-channel-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"process-channel-connection.js","sourceRoot":"","sources":["../../../src/lock-stores/ipc/process-channel-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF;;;;;;GAMG;AACH,MAAM,OAAO,wBAAyB,SAAQ,uBAAoC;IAChF,0FAA0F;IACjF,KAAK,CAAuC;IAErD,YAAY,IAA0C;QACpD,KAAK,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAI,CAAC,OAAoB;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,0FAA0F;IAC1F,GAAG;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TokenSource } from '@zukhruf/fencing';
|
|
2
2
|
import { type LockHandle } from '../../mutex/lease.ts';
|
|
3
3
|
import type { AcquireOptions, LockStore } from '../../mutex/lock-store.ts';
|
|
4
4
|
export interface MemoryStoreOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/memory/memory-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/lock-stores/memory/memory-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,KAAK,UAAU,EAAY,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3E,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,iFAAiF;AACjF,qBAAa,WAAY,YAAW,SAAS;;gBAK/B,EAAE,MAAiC,EAAE,GAAE,kBAAuB;IAIpE,OAAO,CACX,GAAG,EAAE,MAAM,EACX,EAAE,MAAM,EAAE,GAAE,cAAmB,GAC9B,OAAO,CAAC,UAAU,CAAC;IAqBhB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAK9D,+EAA+E;IACzE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Latch, untilAborted } from '@zukhruf/async';
|
|
2
|
-
import { CounterTokenSource } from
|
|
2
|
+
import { CounterTokenSource } from '@zukhruf/fencing';
|
|
3
3
|
import { leaseFor } from "../../mutex/lease.js";
|
|
4
4
|
/** Per-key FIFO line of latches; locks are shared only through this instance. */
|
|
5
5
|
export class MemoryStore {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../../src/lock-stores/memory/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../../src/lock-stores/memory/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AAExE,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