@zukhruf/async 0.8.22 → 0.8.24

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @zukhruf/async
2
2
 
3
- Helpers for code that waits for promises: `untilAborted` cancels a wait, `Latch` holds callers until something happened, `delay` waits a fixed time on a clock, `timeout` stops a wait after a time on a clock, `poll` calls an attempt again until it gives a value, `Backoff` gives a longer wait before each retry, and `ChangeWatcher` reads gauges again and again and tells which values changed. `@zukhruf/mutex`, `@zukhruf/single-flight` and `@zukhruf/election` use them.
3
+ Helpers for code that waits for promises: `untilAborted` cancels a wait, `Latch` holds callers until something happened, `Lock` lets one caller at a time do a thing, `Semaphore` lets a number of callers at a time do it, `delay` waits a fixed time on a clock, `timeout` stops a wait after a time on a clock, `poll` calls an attempt again until it gives a value, `Backoff` gives a longer wait before each retry, and `ChangeWatcher` reads gauges again and again and tells which values changed. `@zukhruf/mutex`, `@zukhruf/single-flight` and `@zukhruf/election` use them.
4
4
 
5
5
  The words in these documents have one meaning each. See the glossary in [CONTEXT.md](./CONTEXT.md).
6
6
 
@@ -54,6 +54,62 @@ A latch never rejects. It keeps its value in a box, so it never adopts a promise
54
54
 
55
55
  To stop a wait on a latch, cancel it: `untilAborted(latch.wait(), signal)`.
56
56
 
57
+ A latch always starts closed. Each latch that a caller opened at once was a lock or a wait group: it ran work in order, or it waited until a count of work was zero. To run work one at a time, see [Let one caller at a time do a thing, with a lock](#let-one-caller-at-a-time-do-a-thing-with-a-lock) (#4519).
58
+
59
+ ## Let one caller at a time do a thing, with a lock
60
+
61
+ A lock lets one caller at a time hold it. The other callers wait in a line, and they get the lock in the order in which they came. `run` holds the lock while the work runs, and frees it when the work ends, also when the work fails.
62
+
63
+ ```ts
64
+ import { Lock } from '@zukhruf/async';
65
+
66
+ const writes = new Lock();
67
+
68
+ // Two writes of the state file never overlap, and they run in the order of the calls.
69
+ await writes.run(() => writeState(state), { signal });
70
+ ```
71
+
72
+ To hold the lock for more than one call, acquire it. Dispose the handle to free the lock: `using` frees it at the end of the block.
73
+
74
+ ```ts
75
+ {
76
+ using held = await writes.acquire({ signal });
77
+ const state = await readState();
78
+ await writeState({ ...state, count: state.count + 1 });
79
+ }
80
+ ```
81
+
82
+ - A failed work rejects `run` with its error, and the next caller then gets the lock. A failed write thus never stops the writes after it.
83
+ - When `signal` aborts while the caller waits, the caller leaves the line, and the call rejects with the reason of the signal. The work of a cancelled `run` never starts.
84
+ - When `signal` aborted before the call, the call rejects at once, and the caller takes nothing, also when the lock is free.
85
+ - `tryAcquire()` gives the handle only when the lock is free and nobody waits, else `undefined`. It never goes before a caller in the line.
86
+ - A second dispose of one handle frees nothing.
87
+ - A lock is not reentrant: a holder that acquires again waits for itself.
88
+ - To limit the wait, give the signal of a `timeout`. See [Stop a wait after a time](#stop-a-wait-after-a-time).
89
+
90
+ A lock is a semaphore of one permit. See [ADR 0013](./docs/adr/0013-a-lock-is-a-semaphore-of-one-that-grants-in-order-and-a-cancel-leaves-the-line.md).
91
+
92
+ ## Let a number of callers at a time do a thing, with a semaphore
93
+
94
+ A semaphore has a count of permits. A caller that finds a free permit holds it at once. A caller that finds no free permit waits in a line, and the permits go to the line in the order in which the callers came. Dispose the permit to give it back.
95
+
96
+ ```ts
97
+ import { Semaphore } from '@zukhruf/async';
98
+
99
+ // At most 4 downloads at the same time.
100
+ const downloads = new Semaphore(4);
101
+
102
+ async function download(url: string) {
103
+ using permit = await downloads.acquire({ signal });
104
+ return fetch(url, { signal });
105
+ }
106
+ ```
107
+
108
+ - A dispose gives the permit to the first caller in the line at once. Thus `tryAcquire()` gives `undefined` while callers wait, also just after a dispose.
109
+ - A cancel, a cancel before the call and a second dispose have the same rules as for a lock.
110
+ - When the turn of a caller comes in the same step as its cancel, the cancel wins, and the permit passes on to the next caller.
111
+ - The constructor throws a `RangeError` for a count of permits that is not a positive integer.
112
+
57
113
  ## Poll an attempt until it gives a value
58
114
 
59
115
  An attempt tries to get a value now, and it does not wait. For example, it tries to take a lock that another process can hold. The attempt gives the value, or `undefined` when there is no value yet. `poll` calls the attempt. When the attempt gives `undefined`, `poll` waits `interval` milliseconds, and then it calls the attempt again. When the attempt gives a value, `poll` resolves with that value.
package/dist/index.d.ts CHANGED
@@ -2,7 +2,9 @@ export { Backoff, type BackoffOptions, type Jitter } from './backoff.ts';
2
2
  export { type Clock, type WallClock } from './clock.ts';
3
3
  export { delay, type DelayOptions } from './delay.ts';
4
4
  export { Latch } from './latch.ts';
5
+ export { Lock } from './lock.ts';
5
6
  export { poll, type PollOptions } from './poll.ts';
7
+ export { type AcquireOptions, Semaphore } from './semaphore.ts';
6
8
  export { timeout, type Timeout, type TimeoutOptions } from './timeout.ts';
7
9
  export { untilAborted } from './until-aborted.ts';
8
10
  export { type Check } from './check.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,OAAO,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA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C;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,9 @@ export { Backoff } from "./backoff.js";
2
2
  export {} from "./clock.js";
3
3
  export { delay } from "./delay.js";
4
4
  export { Latch } from "./latch.js";
5
+ export { Lock } from "./lock.js";
5
6
  export { poll } from "./poll.js";
7
+ export { Semaphore } from "./semaphore.js";
6
8
  export { timeout } from "./timeout.js";
7
9
  export { untilAborted } from "./until-aborted.js";
8
10
  export {} from "./check.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoC,MAAM,cAAc,CAAC;AACzE,OAAO,EAA8B,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAqC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAc,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,aAAa,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAe,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,EAA8B,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoC,MAAM,cAAc,CAAC;AACzE,OAAO,EAA8B,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAC;AACnD,OAAO,EAAuB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAqC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAc,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,aAAa,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAe,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,EAA8B,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
package/dist/lock.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { type AcquireOptions } from './semaphore.ts';
2
+ /**
3
+ * Lets one caller at a time hold it: a semaphore of one permit. Callers that
4
+ * wait get the lock in the order in which they came.
5
+ */
6
+ export declare class Lock {
7
+ #private;
8
+ /** Waits in the line for the lock. Dispose the handle to free it: `using held = await lock.acquire(…)`. */
9
+ acquire(options: AcquireOptions): Promise<Disposable>;
10
+ /** Gives the lock only when it is free and nobody waits. */
11
+ tryAcquire(): Disposable | undefined;
12
+ /** Holds the lock while `work` runs, and frees it when the work ends, also when the work fails. */
13
+ run<T>(work: () => Promise<T>, options: AcquireOptions): Promise<T>;
14
+ }
15
+ //# sourceMappingURL=lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAEhE;;;GAGG;AACH,qBAAa,IAAI;;IAGf,2GAA2G;IAC3G,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAIrD,4DAA4D;IAC5D,UAAU,IAAI,UAAU,GAAG,SAAS;IAIpC,mGAAmG;IAC7F,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;CAI1E"}
package/dist/lock.js ADDED
@@ -0,0 +1,22 @@
1
+ import { Semaphore } from "./semaphore.js";
2
+ /**
3
+ * Lets one caller at a time hold it: a semaphore of one permit. Callers that
4
+ * wait get the lock in the order in which they came.
5
+ */
6
+ export class Lock {
7
+ #semaphore = new Semaphore(1);
8
+ /** Waits in the line for the lock. Dispose the handle to free it: `using held = await lock.acquire(…)`. */
9
+ acquire(options) {
10
+ return this.#semaphore.acquire(options);
11
+ }
12
+ /** Gives the lock only when it is free and nobody waits. */
13
+ tryAcquire() {
14
+ return this.#semaphore.tryAcquire();
15
+ }
16
+ /** Holds the lock while `work` runs, and frees it when the work ends, also when the work fails. */
17
+ async run(work, options) {
18
+ using _held = await this.acquire(options);
19
+ return await work();
20
+ }
21
+ }
22
+ //# sourceMappingURL=lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.js","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;GAGG;AACH,MAAM,OAAO,IAAI;IACN,UAAU,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;IAEvC,2GAA2G;IAC3G,OAAO,CAAC,OAAuB;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,4DAA4D;IAC5D,UAAU;QACR,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;IACtC,CAAC;IAED,mGAAmG;IACnG,KAAK,CAAC,GAAG,CAAI,IAAsB,EAAE,OAAuB;QAC1D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ export interface AcquireOptions {
2
+ /** Cancels the wait: the caller leaves the line, and the acquire rejects with `signal.reason`. */
3
+ signal: AbortSignal | undefined;
4
+ }
5
+ /**
6
+ * Lets at most `permits` callers hold a permit at the same time. A caller
7
+ * that finds no free permit waits in a line, and the permits go to the line
8
+ * in the order in which the callers came. A dispose of a permit gives it to
9
+ * the first waiter, so a later caller never takes it first.
10
+ */
11
+ export declare class Semaphore {
12
+ #private;
13
+ constructor(permits: number);
14
+ /**
15
+ * Gives a permit when one is free, or waits in the line for one. Dispose
16
+ * the permit to give it back: `using permit = await semaphore.acquire(…)`.
17
+ * When the signal aborts, also before the call, the caller takes no permit.
18
+ */
19
+ acquire({ signal }: AcquireOptions): Promise<Disposable>;
20
+ /** Gives a permit only when one is free, which is never while callers wait in the line. */
21
+ tryAcquire(): Disposable | undefined;
22
+ }
23
+ //# sourceMappingURL=semaphore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semaphore.d.ts","sourceRoot":"","sources":["../src/semaphore.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,kGAAkG;IAClG,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC;AAED;;;;;GAKG;AACH,qBAAa,SAAS;;gBAOR,OAAO,EAAE,MAAM;IAQ3B;;;;OAIG;IACG,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAkB9D,2FAA2F;IAC3F,UAAU,IAAI,UAAU,GAAG,SAAS;CAqBrC"}
@@ -0,0 +1,70 @@
1
+ import { untilAborted } from "./until-aborted.js";
2
+ /**
3
+ * Lets at most `permits` callers hold a permit at the same time. A caller
4
+ * that finds no free permit waits in a line, and the permits go to the line
5
+ * in the order in which the callers came. A dispose of a permit gives it to
6
+ * the first waiter, so a later caller never takes it first.
7
+ */
8
+ export class Semaphore {
9
+ #free;
10
+ /** The turns of the waiters, first in line first. A dispose calls the first one. */
11
+ #line = [];
12
+ /** The permits that holders have not disposed yet, so a second dispose of one permit frees nothing. */
13
+ #held = new Set();
14
+ constructor(permits) {
15
+ if (!(Number.isInteger(permits) && permits > 0))
16
+ throw new RangeError(`permits must be a positive integer, not ${permits}`);
17
+ this.#free = permits;
18
+ }
19
+ /**
20
+ * Gives a permit when one is free, or waits in the line for one. Dispose
21
+ * the permit to give it back: `using permit = await semaphore.acquire(…)`.
22
+ * When the signal aborts, also before the call, the caller takes no permit.
23
+ */
24
+ async acquire({ signal }) {
25
+ signal?.throwIfAborted();
26
+ const free = this.tryAcquire();
27
+ if (free)
28
+ return free;
29
+ const turn = Promise.withResolvers();
30
+ this.#line.push(turn.resolve);
31
+ try {
32
+ await untilAborted(turn.promise, signal);
33
+ }
34
+ catch (error) {
35
+ const place = this.#line.indexOf(turn.resolve);
36
+ // The turn came in the same step as the cancel: the permit passes on.
37
+ if (place === -1)
38
+ this.#release();
39
+ else
40
+ this.#line.splice(place, 1);
41
+ throw error;
42
+ }
43
+ return this.#permit();
44
+ }
45
+ /** Gives a permit only when one is free, which is never while callers wait in the line. */
46
+ tryAcquire() {
47
+ if (this.#free === 0)
48
+ return undefined;
49
+ this.#free--;
50
+ return this.#permit();
51
+ }
52
+ #permit() {
53
+ const permit = {
54
+ [Symbol.dispose]: () => {
55
+ if (this.#held.delete(permit))
56
+ this.#release();
57
+ },
58
+ };
59
+ this.#held.add(permit);
60
+ return permit;
61
+ }
62
+ #release() {
63
+ const next = this.#line.shift();
64
+ if (next)
65
+ next();
66
+ else
67
+ this.#free++;
68
+ }
69
+ }
70
+ //# sourceMappingURL=semaphore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semaphore.js","sourceRoot":"","sources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AC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,2FAA2F;IAC3F,UAAU;QACR,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,OAAO;QACL,MAAM,MAAM,GAAe;YACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE;gBACrB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;oBAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjD,CAAC;SACF,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,IAAI;YAAE,IAAI,EAAE,CAAC;;YACZ,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/async",
3
- "version": "0.8.22",
3
+ "version": "0.8.24",
4
4
  "description": "Helpers for code that waits for promises: cancel a wait when an AbortSignal aborts, hold callers on a one-shot latch that never rejects, and poll an attempt until it gives a value.",
5
5
  "license": "MIT",
6
6
  "repository": {