@zukhruf/async 0.8.26 → 0.8.27

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, `Future` gives callers the value or the failure of work that ends once, `Lock` lets one caller at a time do a thing, `Semaphore` lets a number of callers at a time do it, `WaitGroup` waits until the work in flight is done, `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, `Future` gives callers the value or the failure of work that ends once, `Lock` lets one caller at a time do a thing, `Semaphore` lets a number of callers at a time do it, `WaitGroup` waits until the work in flight is done, `Cond` wakes every caller that waits now, `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
 
@@ -169,6 +169,36 @@ await commands.wait({ signal });
169
169
 
170
170
  A wait group holds a latch, and puts a new latch in its place each time the count reaches zero. See [ADR 0015](./docs/adr/0015-a-wait-group-counts-disposable-tokens-and-may-count-up-again-after-zero.md).
171
171
 
172
+ ## Wake every caller that waits now, with a cond
173
+
174
+ A cond wakes the callers that wait for a change of a state. `broadcast()` ends each wait that started before it. A cond carries no value, so a woken caller checks its state again, and waits again when the state has not changed.
175
+
176
+ ```ts
177
+ import { Cond } from '@zukhruf/async';
178
+
179
+ const arrived = new Cond();
180
+ const queue: Job[] = [];
181
+
182
+ function give(job: Job) {
183
+ queue.push(job);
184
+ arrived.broadcast();
185
+ }
186
+
187
+ async function take(signal: AbortSignal) {
188
+ while (queue.length === 0) await arrived.wait({ signal });
189
+ return queue.shift();
190
+ }
191
+ ```
192
+
193
+ - A wait starts in the step of the call. Thus a wait that starts just before a broadcast, in the same step, ends at that broadcast, and a check of the state followed by a wait cannot miss a broadcast.
194
+ - A broadcast keeps nothing. A wait that starts after a broadcast waits for the next one.
195
+ - A broadcast with no wait changes nothing.
196
+ - When `signal` aborts during the wait, the wait rejects with the reason of the signal, and its listener leaves the signal. The other waits still end at the next broadcast.
197
+ - When `signal` aborted before the call, the wait rejects at once.
198
+ - No listener stays on the signal after a wait ends, so a signal that lives long can serve many waits.
199
+
200
+ A cond is the one of Go `sync.Cond`, without its lock: the step of the call does the job of the lock. A cond holds a latch, and puts a new latch in its place at each broadcast. See [ADR 0016](./docs/adr/0016-a-cond-wakes-the-waits-that-started-before-a-broadcast-and-keeps-nothing-for-a-later-wait.md).
201
+
172
202
  ## Poll an attempt until it gives a value
173
203
 
174
204
  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/cond.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { type WaitOptions } from './wait-options.ts';
2
+ /**
3
+ * Wakes every caller that waits now. A broadcast ends each wait that
4
+ * started before it, and keeps nothing for a later wait. A cond carries no
5
+ * value: a woken caller checks its state again, and waits again when the
6
+ * state has not changed. The name is the one of Go `sync.Cond`, without
7
+ * its lock: a wait registers in the step of the call, so no broadcast can
8
+ * come between the check of the state and the wait.
9
+ */
10
+ export declare class Cond {
11
+ #private;
12
+ /**
13
+ * Ends at the first broadcast after the call, also a broadcast in the
14
+ * same step. When the signal aborts, also before the call, the wait
15
+ * rejects with its reason.
16
+ */
17
+ wait({ signal }: WaitOptions): Promise<void>;
18
+ /** Ends each wait that started before this call. With no wait, it changes nothing. */
19
+ broadcast(): void;
20
+ }
21
+ //# sourceMappingURL=cond.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cond.d.ts","sourceRoot":"","sources":["../src/cond.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,qBAAa,IAAI;;IAIf;;;;OAIG;IACG,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlD,sFAAsF;IACtF,SAAS,IAAI,IAAI;CAIlB"}
package/dist/cond.js ADDED
@@ -0,0 +1,30 @@
1
+ import { Latch } from "./latch.js";
2
+ import { untilAborted } from "./until-aborted.js";
3
+ import {} from "./wait-options.js";
4
+ /**
5
+ * Wakes every caller that waits now. A broadcast ends each wait that
6
+ * started before it, and keeps nothing for a later wait. A cond carries no
7
+ * value: a woken caller checks its state again, and waits again when the
8
+ * state has not changed. The name is the one of Go `sync.Cond`, without
9
+ * its lock: a wait registers in the step of the call, so no broadcast can
10
+ * come between the check of the state and the wait.
11
+ */
12
+ export class Cond {
13
+ /** Opens at the next broadcast. A new latch then takes its place for the waits after that broadcast. */
14
+ #broadcast = new Latch();
15
+ /**
16
+ * Ends at the first broadcast after the call, also a broadcast in the
17
+ * same step. When the signal aborts, also before the call, the wait
18
+ * rejects with its reason.
19
+ */
20
+ async wait({ signal }) {
21
+ signal?.throwIfAborted();
22
+ await untilAborted(this.#broadcast.wait(), signal);
23
+ }
24
+ /** Ends each wait that started before this call. With no wait, it changes nothing. */
25
+ broadcast() {
26
+ this.#broadcast.open();
27
+ this.#broadcast = new Latch();
28
+ }
29
+ }
30
+ //# sourceMappingURL=cond.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cond.js","sourceRoot":"","sources":["../src/cond.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,OAAO,IAAI;IACf,wGAAwG;IACxG,UAAU,GAAG,IAAI,KAAK,EAAE,CAAC;IAEzB;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAe;QAChC,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,MAAM,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,sFAAsF;IACtF,SAAS;QACP,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,EAAE,CAAC;IAChC,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Backoff, type BackoffOptions, type Jitter } from './backoff.ts';
2
2
  export { type Clock, type WallClock } from './clock.ts';
3
+ export { Cond } from './cond.ts';
3
4
  export { delay, type DelayOptions } from './delay.ts';
4
5
  export { Future } from './future.ts';
5
6
  export { Latch } from './latch.ts';
@@ -8,7 +9,8 @@ export { poll, type PollOptions } from './poll.ts';
8
9
  export { type AcquireOptions, Semaphore } from './semaphore.ts';
9
10
  export { timeout, type Timeout, type TimeoutOptions } from './timeout.ts';
10
11
  export { untilAborted } from './until-aborted.ts';
11
- export { WaitGroup, type WaitOptions } from './wait-group.ts';
12
+ export { WaitGroup } from './wait-group.ts';
13
+ export { type WaitOptions } from './wait-options.ts';
12
14
  export { type Check } from './check.ts';
13
15
  export { ChangeWatcher, type ChangeWatcherOptions, type Outcome, } from './change-watcher.ts';
14
16
  export { Collector, type Sample } from './collector.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],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./cond.js";
3
4
  export { delay } from "./delay.js";
4
5
  export { Future } from "./future.js";
5
6
  export { Latch } from "./latch.js";
@@ -9,6 +10,7 @@ export { Semaphore } from "./semaphore.js";
9
10
  export { timeout } from "./timeout.js";
10
11
  export { untilAborted } from "./until-aborted.js";
11
12
  export { WaitGroup } from "./wait-group.js";
13
+ export {} from "./wait-options.js";
12
14
  export {} from "./check.js";
13
15
  export { ChangeWatcher, } from "./change-watcher.js";
14
16
  export { Collector } from "./collector.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,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,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,EAAE,SAAS,EAAoB,MAAM,iBAAiB,CAAC;AAC9D,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,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,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,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AACrD,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,7 +1,4 @@
1
- export interface WaitOptions {
2
- /** Cancels the wait: the wait rejects with `signal.reason`. The count does not change. */
3
- signal: AbortSignal | undefined;
4
- }
1
+ import { type WaitOptions } from './wait-options.ts';
5
2
  /**
6
3
  * Counts the work in flight, and lets callers wait until the count is zero.
7
4
  * Each `add` gives a token, and the group counts the token until a dispose.
@@ -16,7 +13,8 @@ export declare class WaitGroup {
16
13
  /**
17
14
  * Ends at once when the count is zero, else when the count next reaches
18
15
  * zero, also when an `add` follows in the same step. When the signal
19
- * aborts, also before the call, the wait rejects with its reason.
16
+ * aborts, also before the call, the wait rejects with its reason, and
17
+ * the count does not change.
20
18
  */
21
19
  wait({ signal }: WaitOptions): Promise<void>;
22
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wait-group.d.ts","sourceRoot":"","sources":["../src/wait-group.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,0FAA0F;IAC1F,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC;AAED;;;;;;GAMG;AACH,qBAAa,SAAS;;IAMpB,qFAAqF;IACrF,GAAG,IAAI,UAAU;IAajB;;;;OAIG;IACG,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAKnD"}
1
+ {"version":3,"file":"wait-group.d.ts","sourceRoot":"","sources":["../src/wait-group.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;GAMG;AACH,qBAAa,SAAS;;IAMpB,qFAAqF;IACrF,GAAG,IAAI,UAAU;IAajB;;;;;OAKG;IACG,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAKnD"}
@@ -1,5 +1,6 @@
1
1
  import { Latch } from "./latch.js";
2
2
  import { untilAborted } from "./until-aborted.js";
3
+ import {} from "./wait-options.js";
3
4
  /**
4
5
  * Counts the work in flight, and lets callers wait until the count is zero.
5
6
  * Each `add` gives a token, and the group counts the token until a dispose.
@@ -28,7 +29,8 @@ export class WaitGroup {
28
29
  /**
29
30
  * Ends at once when the count is zero, else when the count next reaches
30
31
  * zero, also when an `add` follows in the same step. When the signal
31
- * aborts, also before the call, the wait rejects with its reason.
32
+ * aborts, also before the call, the wait rejects with its reason, and
33
+ * the count does not change.
32
34
  */
33
35
  async wait({ signal }) {
34
36
  signal?.throwIfAborted();
@@ -1 +1 @@
1
- {"version":3,"file":"wait-group.js","sourceRoot":"","sources":["../src/wait-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IACpB,4GAA4G;IACnG,OAAO,GAAG,IAAI,GAAG,EAAc,CAAC;IACzC,8GAA8G;IAC9G,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAEpB,qFAAqF;IACrF,GAAG;QACD,MAAM,KAAK,GAAe;YACxB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE;gBACrB,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;oBAC1D,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;oBAClB,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;gBAC3B,CAAC;YACH,CAAC;SACF,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAe;QAChC,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO;QACpC,MAAM,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF"}
1
+ {"version":3,"file":"wait-group.js","sourceRoot":"","sources":["../src/wait-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IACpB,4GAA4G;IACnG,OAAO,GAAG,IAAI,GAAG,EAAc,CAAC;IACzC,8GAA8G;IAC9G,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAEpB,qFAAqF;IACrF,GAAG;QACD,MAAM,KAAK,GAAe;YACxB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE;gBACrB,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;oBAC1D,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;oBAClB,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;gBAC3B,CAAC;YACH,CAAC;SACF,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAe;QAChC,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO;QACpC,MAAM,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export interface WaitOptions {
2
+ /** Cancels the wait: the wait rejects with `signal.reason`. */
3
+ signal: AbortSignal | undefined;
4
+ }
5
+ //# sourceMappingURL=wait-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-options.d.ts","sourceRoot":"","sources":["../src/wait-options.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,+DAA+D;IAC/D,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=wait-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-options.js","sourceRoot":"","sources":["../src/wait-options.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/async",
3
- "version": "0.8.26",
3
+ "version": "0.8.27",
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": {