@zukhruf/election 0.8.237 → 0.8.238
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 +11 -10
- package/dist/clean-up-after.d.ts +8 -0
- package/dist/clean-up-after.d.ts.map +1 -1
- package/dist/clean-up-after.js +20 -10
- package/dist/clean-up-after.js.map +1 -1
- package/dist/leader-election.d.ts.map +1 -1
- package/dist/leader-election.js +3 -8
- package/dist/leader-election.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -221,7 +221,7 @@ A backend must keep six rules:
|
|
|
221
221
|
2. `tryClaim` gives `afterCleanShutdown: true` only when the term just before this one recorded a clean shutdown. It reads each record one time only. Thus a crash after a clean term never reads as clean.
|
|
222
222
|
3. `watch` calls `lose` before the backend can give the claim to another candidate. For a claim that the backend keeps only for a time, renew it well before that time ends, and count the time on a monotonic clock. Then an old leader stops before a new one starts.
|
|
223
223
|
4. The campaign never calls `recordCleanShutdown` or `release` after a loss, because the claim can be another candidate's then.
|
|
224
|
-
5. The campaign calls `close` after each end: a won term, a lost term, a failed attempt, or an attempt that never won. When a step fails and `release` or `close` fails too, the campaign rejects with a `SuppressedError`: its `suppressed` is the step's error, and its `error` is the failure to give the claim up or free it.
|
|
224
|
+
5. The campaign calls `close` after each end: a won term, a lost term, a failed attempt, or an attempt that never won. When a step fails and `release` or `close` fails too, the campaign rejects with a `SuppressedError`: its `suppressed` is the step's error, and its `error` is the failure to give the claim up or free it. When the release and the close both fail, that `error` is itself a `SuppressedError` of the close's failure over the release's. When two of these failures are one error, the campaign keeps it once and does not suppress it under itself, so when every step fails with one error, the campaign rejects with that error ([ADR 0014](./docs/adr/0014-a-campaign-whose-step-and-cleanup-fail-with-one-error-rejects-with-that-error.md)).
|
|
225
225
|
6. `waitForChange` settles when its signal aborts, and it never ends the attempt itself. The campaign aborts that signal at its `timeout`, and then it tries one last time. A backend with no push polls in its own `waitForChange`, for example with `delay` of `@zukhruf/async`.
|
|
226
226
|
|
|
227
227
|
This backend elects among the candidates of one process. Its claim is an entry in a map, and it has no push, so it polls:
|
|
@@ -299,14 +299,14 @@ The socket lock store of `@zukhruf/mutex` uses `SqliteElection`, with the claim
|
|
|
299
299
|
|
|
300
300
|
## Errors
|
|
301
301
|
|
|
302
|
-
| Error | When
|
|
303
|
-
| ------------------------------ |
|
|
304
|
-
| `NetworkDirectoryError` | The directory of a `SqliteElection` is on a network file system. It is the class of `@zukhruf/fs`.
|
|
305
|
-
| `LeaseLostError` | The reason of `term.signal` when the backend took the claim away. Its `subject` is `'leadership'`, and its `cause` is the backend's reason. It is the class of `@zukhruf/lease`, and this package exports it too.
|
|
306
|
-
| `signal.reason` | A campaign rejects with it when its signal aborts.
|
|
307
|
-
| `SuppressedError` | A campaign or a resign rejects with it when a step failed and giving the claim up or freeing it failed too. Its `suppressed` is the step's error, and its `error` is the failure to free. A resign whose
|
|
308
|
-
| `RangeError` | A campaign of a `SqliteElection` rejects with it when the next epoch would be 2^31 or more. The message names `epochFile`.
|
|
309
|
-
| The failure of a leader's task | `ended` and the dispose of a `LeaderSelector` reject with the error of a task that failed, of a resign that failed, and, without `autoRequeue`, of a failed campaign. `requeue()` throws an `Error` after the dispose, and after a failure ended the selector.
|
|
302
|
+
| Error | When |
|
|
303
|
+
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
304
|
+
| `NetworkDirectoryError` | The directory of a `SqliteElection` is on a network file system. It is the class of `@zukhruf/fs`. |
|
|
305
|
+
| `LeaseLostError` | The reason of `term.signal` when the backend took the claim away. Its `subject` is `'leadership'`, and its `cause` is the backend's reason. It is the class of `@zukhruf/lease`, and this package exports it too. |
|
|
306
|
+
| `signal.reason` | A campaign rejects with it when its signal aborts. |
|
|
307
|
+
| `SuppressedError` | A campaign or a resign rejects with it when a step failed and giving the claim up or freeing it failed too. Its `suppressed` is the step's error, and its `error` is the failure to free. A campaign or a resign whose steps fail with one error rejects with that error instead. A `LeaderSelector` ends with it when its task failed and the resign failed with another error. |
|
|
308
|
+
| `RangeError` | A campaign of a `SqliteElection` rejects with it when the next epoch would be 2^31 or more. The message names `epochFile`. |
|
|
309
|
+
| The failure of a leader's task | `ended` and the dispose of a `LeaderSelector` reject with the error of a task that failed, of a resign that failed, and, without `autoRequeue`, of a failed campaign. `requeue()` throws an `Error` after the dispose, and after a failure ended the selector. |
|
|
310
310
|
|
|
311
311
|
A failure that no caller waits for is a process warning, in the shape of [root ADR 0010](../../docs/adr/0010-a-package-warning-names-its-type-code-and-subject-and-keeps-the-failure-as-its-cause.md). A `'warning'` listener reads its type as `name`, its `code`, and its subject in `detail`, one `<term>: <value>` line each. Its `cause` is the failure, and its message ends with the failure's message. `--disable-warning=<code or type>` stops the print. `TermWarning` and `LeaderSelectorWarning` are classes that the package exports, so a listener can test `warning instanceof` the class ([root ADR 0011](../../docs/adr/0011-a-package-warning-is-an-instance-of-its-own-class-which-the-package-exports.md)). With two installed copies of the package, `instanceof` fails across the copies, so compare `code`.
|
|
312
312
|
|
|
@@ -454,7 +454,8 @@ export { LeaseLostError } from '@zukhruf/lease';
|
|
|
454
454
|
- [ADR 0010: An election has a name, and the name of a SQLite election is the path of its claim file](./docs/adr/0010-an-election-has-a-name-and-the-name-of-a-sqlite-election-is-the-path-of-its-claim-file.md)
|
|
455
455
|
- [ADR 0011: A leader selector runs a task each time it wins a term of a leader election, over a `LeaderElection` only](./docs/adr/0011-a-leader-selector-runs-a-task-each-time-it-wins-a-term-of-a-leader-election.md)
|
|
456
456
|
- [ADR 0012: A task failure and a resign failure that are one error end the leader selector with that error](./docs/adr/0012-a-task-failure-and-a-resign-failure-that-are-one-error-end-the-leader-selector-with-that-error.md)
|
|
457
|
-
- [ADR 0013: A term whose two steps fail with one error ends with that error](./docs/adr/0013-a-term-whose-two-steps-fail-with-one-error-ends-with-that-error.md)
|
|
457
|
+
- [ADR 0013: A term whose two steps fail with one error ends with that error](./docs/adr/0013-a-term-whose-two-steps-fail-with-one-error-ends-with-that-error.md) (superseded in part by ADR 0014)
|
|
458
|
+
- [ADR 0014: A campaign whose step and cleanup fail with one error rejects with that error](./docs/adr/0014-a-campaign-whose-step-and-cleanup-fail-with-one-error-rejects-with-that-error.md)
|
|
458
459
|
- [Code copied into this package](./docs/copied-code.md)
|
|
459
460
|
|
|
460
461
|
## Development
|
package/dist/clean-up-after.d.ts
CHANGED
|
@@ -6,4 +6,12 @@
|
|
|
6
6
|
* `await using` would suppress it under itself (ADR 0012).
|
|
7
7
|
*/
|
|
8
8
|
export declare function cleanUpAfter(body: () => Promise<void> | void, cleanup: () => Promise<void>, message: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Runs `cleanup` after `failure`, and rejects with `failure`. When `cleanup`
|
|
11
|
+
* fails with another error, it rejects with a `SuppressedError` of that
|
|
12
|
+
* error over `failure`, with `message`. When `cleanup` fails with `failure`
|
|
13
|
+
* itself, it rejects with `failure`, not with the error suppressed under
|
|
14
|
+
* itself (ADR 0012).
|
|
15
|
+
*/
|
|
16
|
+
export declare function cleanUpAfterFailure(failure: unknown, cleanup: () => Promise<void>, message: string): Promise<never>;
|
|
9
17
|
//# sourceMappingURL=clean-up-after.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-up-after.d.ts","sourceRoot":"","sources":["../src/clean-up-after.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EAChC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"clean-up-after.d.ts","sourceRoot":"","sources":["../src/clean-up-after.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EAChC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,KAAK,CAAC,CAUhB"}
|
package/dist/clean-up-after.js
CHANGED
|
@@ -10,17 +10,27 @@ export async function cleanUpAfter(body, cleanup, message) {
|
|
|
10
10
|
await body();
|
|
11
11
|
}
|
|
12
12
|
catch (failure) {
|
|
13
|
-
|
|
14
|
-
await cleanup();
|
|
15
|
-
}
|
|
16
|
-
catch (cleanupFailure) {
|
|
17
|
-
if (cleanupFailure === failure) {
|
|
18
|
-
throw failure;
|
|
19
|
-
}
|
|
20
|
-
throw new SuppressedError(cleanupFailure, failure, message);
|
|
21
|
-
}
|
|
22
|
-
throw failure;
|
|
13
|
+
return cleanUpAfterFailure(failure, cleanup, message);
|
|
23
14
|
}
|
|
24
15
|
await cleanup();
|
|
25
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Runs `cleanup` after `failure`, and rejects with `failure`. When `cleanup`
|
|
19
|
+
* fails with another error, it rejects with a `SuppressedError` of that
|
|
20
|
+
* error over `failure`, with `message`. When `cleanup` fails with `failure`
|
|
21
|
+
* itself, it rejects with `failure`, not with the error suppressed under
|
|
22
|
+
* itself (ADR 0012).
|
|
23
|
+
*/
|
|
24
|
+
export async function cleanUpAfterFailure(failure, cleanup, message) {
|
|
25
|
+
try {
|
|
26
|
+
await cleanup();
|
|
27
|
+
}
|
|
28
|
+
catch (cleanupFailure) {
|
|
29
|
+
if (cleanupFailure === failure) {
|
|
30
|
+
throw failure;
|
|
31
|
+
}
|
|
32
|
+
throw new SuppressedError(cleanupFailure, failure, message);
|
|
33
|
+
}
|
|
34
|
+
throw failure;
|
|
35
|
+
}
|
|
26
36
|
//# sourceMappingURL=clean-up-after.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-up-after.js","sourceRoot":"","sources":["../src/clean-up-after.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAgC,EAChC,OAA4B,EAC5B,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,OAAO,EAAE,CAAC;QACjB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"clean-up-after.js","sourceRoot":"","sources":["../src/clean-up-after.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAgC,EAChC,OAA4B,EAC5B,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,OAAO,EAAE,CAAC;QACjB,OAAO,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,OAAO,EAAE,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAgB,EAChB,OAA4B,EAC5B,OAAe;IAEf,IAAI,CAAC;QACH,MAAM,OAAO,EAAE,CAAC;IAClB,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACxB,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;YAC/B,MAAM,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,eAAe,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leader-election.d.ts","sourceRoot":"","sources":["../src/leader-election.ts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E,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,0GAA0G;IAC1G,SAAS,CAAC,QAAQ,CAAC,KAAK,CACtB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,IAAI,GAC5B,UAAU,CAAC;IAEd;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,CACpC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,uDAAuD;IACvD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD,yEAAyE;IACzE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CA4FvD"}
|
package/dist/leader-election.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { timeout as deadlineAfter } from '@zukhruf/async';
|
|
2
|
+
import { cleanUpAfter, cleanUpAfterFailure } from './clean-up-after.js';
|
|
2
3
|
import { Term } from './term.js';
|
|
3
4
|
/**
|
|
4
5
|
* Elects one leader among candidates. The campaign is the same for each
|
|
@@ -56,9 +57,7 @@ export class LeaderElection {
|
|
|
56
57
|
won = await this.#tryUntil(claim, deadline, signal);
|
|
57
58
|
}
|
|
58
59
|
catch (error) {
|
|
59
|
-
|
|
60
|
-
closing.defer(() => this.close(claim));
|
|
61
|
-
throw error;
|
|
60
|
+
return cleanUpAfterFailure(error, () => this.close(claim), 'The campaign failed while it tried its claim, and failed to free its attempt.');
|
|
62
61
|
}
|
|
63
62
|
if (won === undefined) {
|
|
64
63
|
await this.close(claim);
|
|
@@ -108,11 +107,7 @@ export class LeaderElection {
|
|
|
108
107
|
});
|
|
109
108
|
}
|
|
110
109
|
catch (error) {
|
|
111
|
-
|
|
112
|
-
await using giveUp = new AsyncDisposableStack();
|
|
113
|
-
giveUp.defer(() => this.close(claim));
|
|
114
|
-
giveUp.defer(() => this.release(claim));
|
|
115
|
-
throw error;
|
|
110
|
+
return cleanUpAfterFailure(error, () => cleanUpAfter(() => this.release(claim), () => this.close(claim), 'The campaign failed to give its won claim up, and failed to free it.'), 'The campaign failed to begin the term of its won claim, and failed to give the claim up and free it.');
|
|
116
111
|
}
|
|
117
112
|
return term.signal.aborted ? 'lost' : term;
|
|
118
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leader-election.js","sourceRoot":"","sources":["../src/leader-election.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAajC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAgB,cAAc;IAClC;;;OAGG;IACM,IAAI,CAAS;IACtB,qFAAqF;IAClE,KAAK,CAAQ;IAEhC,YAAsB,IAAY,EAAE,KAAY;QAC9C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,MAAM,EAAE,GAAoB,EAAE;QAG1D,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC;QACxD,SAAS,CAAC;YACR,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACtD,+EAA+E;YAC/E,IAAI,OAAO,KAAK,MAAM;gBAAE,OAAO,OAAO,CAAC;QACzC,CAAC;IACH,CAAC;IA8CD,KAAK,CAAC,QAAQ,CACZ,QAAgB,EACh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CAAC;YACf,OAAO,mBAAmB,CACxB,KAAK,EACL,GAAG,EAAE,CACH,YAAY,CACV,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EACzB,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EACvB,sEAAsE,CACvE,EACH,sGAAsG,CACvG,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zukhruf/election",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.238",
|
|
4
4
|
"description": "Elects a leader among candidates. Each term has a higher epoch and ends when the leader resigns or dies. Backends subclass one campaign. `SqliteElection` elects among processes of one host; candidates and observers end a leader whose pipe heartbeats stop.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@zukhruf/async": "^0.8.
|
|
44
|
-
"@zukhruf/fs": "^0.8.
|
|
45
|
-
"@zukhruf/lease": "^0.8.
|
|
46
|
-
"@zukhruf/pipes": "^0.8.
|
|
43
|
+
"@zukhruf/async": "^0.8.238",
|
|
44
|
+
"@zukhruf/fs": "^0.8.238",
|
|
45
|
+
"@zukhruf/lease": "^0.8.238",
|
|
46
|
+
"@zukhruf/pipes": "^0.8.238"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@sinonjs/fake-timers": "15.5.0",
|
|
50
|
-
"@zukhruf/parameterized-test": "^0.8.
|
|
51
|
-
"@zukhruf/process": "^0.8.
|
|
52
|
-
"@zukhruf/testing": "^0.8.
|
|
50
|
+
"@zukhruf/parameterized-test": "^0.8.238",
|
|
51
|
+
"@zukhruf/process": "^0.8.238",
|
|
52
|
+
"@zukhruf/testing": "^0.8.238"
|
|
53
53
|
}
|
|
54
54
|
}
|