@wavehouse/chtypes 2.0.0-dev.5 → 2.0.0-dev.7

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/abi2/buildinfo.d.ts +1 -1
  3. package/dist/abi2/buildinfo.js +3 -3
  4. package/dist/abi2/buildinfo.js.map +1 -1
  5. package/dist/abi2/errors.d.ts +16 -38
  6. package/dist/abi2/errors.d.ts.map +1 -1
  7. package/dist/abi2/errors.js +16 -42
  8. package/dist/abi2/errors.js.map +1 -1
  9. package/dist/abi2/index.d.ts +1 -1
  10. package/dist/abi2/index.d.ts.map +1 -1
  11. package/dist/abi2/index.js +1 -1
  12. package/dist/abi2/index.js.map +1 -1
  13. package/dist/abi2/libc.gen.d.ts +2 -0
  14. package/dist/abi2/libc.gen.d.ts.map +1 -1
  15. package/dist/abi2/libc.gen.js +10 -0
  16. package/dist/abi2/libc.gen.js.map +1 -1
  17. package/dist/abi2/loader.js +2 -2
  18. package/dist/abi2/loader.js.map +1 -1
  19. package/dist/cli.d.ts +8 -3
  20. package/dist/cli.d.ts.map +1 -1
  21. package/dist/cli.js +94 -11
  22. package/dist/cli.js.map +1 -1
  23. package/dist/env.d.ts +8 -1
  24. package/dist/env.d.ts.map +1 -1
  25. package/dist/env.js +17 -8
  26. package/dist/env.js.map +1 -1
  27. package/dist/index.d.ts +5 -4
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +5 -4
  30. package/dist/index.js.map +1 -1
  31. package/dist/ocifetch/channel.d.ts +6 -0
  32. package/dist/ocifetch/channel.d.ts.map +1 -1
  33. package/dist/ocifetch/channel.js +31 -1
  34. package/dist/ocifetch/channel.js.map +1 -1
  35. package/dist/ocifetch/constants.gen.d.ts +20 -0
  36. package/dist/ocifetch/constants.gen.d.ts.map +1 -1
  37. package/dist/ocifetch/constants.gen.js +20 -1
  38. package/dist/ocifetch/constants.gen.js.map +1 -1
  39. package/dist/ocifetch/ensure.d.ts +42 -8
  40. package/dist/ocifetch/ensure.d.ts.map +1 -1
  41. package/dist/ocifetch/ensure.js +111 -41
  42. package/dist/ocifetch/ensure.js.map +1 -1
  43. package/dist/ocifetch/errors.d.ts +51 -27
  44. package/dist/ocifetch/errors.d.ts.map +1 -1
  45. package/dist/ocifetch/errors.js +49 -38
  46. package/dist/ocifetch/errors.js.map +1 -1
  47. package/dist/ocifetch/hold.d.ts +66 -0
  48. package/dist/ocifetch/hold.d.ts.map +1 -0
  49. package/dist/ocifetch/hold.js +150 -0
  50. package/dist/ocifetch/hold.js.map +1 -0
  51. package/dist/ocifetch/http.d.ts.map +1 -1
  52. package/dist/ocifetch/http.js +1 -1
  53. package/dist/ocifetch/http.js.map +1 -1
  54. package/dist/ocifetch/index.d.ts +6 -2
  55. package/dist/ocifetch/index.d.ts.map +1 -1
  56. package/dist/ocifetch/index.js +5 -1
  57. package/dist/ocifetch/index.js.map +1 -1
  58. package/dist/ocifetch/lock.d.ts +2 -1
  59. package/dist/ocifetch/lock.d.ts.map +1 -1
  60. package/dist/ocifetch/lock.js +7 -5
  61. package/dist/ocifetch/lock.js.map +1 -1
  62. package/dist/ocifetch/oci.d.ts +38 -6
  63. package/dist/ocifetch/oci.d.ts.map +1 -1
  64. package/dist/ocifetch/oci.js +48 -12
  65. package/dist/ocifetch/oci.js.map +1 -1
  66. package/dist/ocifetch/prune.d.ts +48 -0
  67. package/dist/ocifetch/prune.d.ts.map +1 -0
  68. package/dist/ocifetch/prune.js +383 -0
  69. package/dist/ocifetch/prune.js.map +1 -0
  70. package/dist/ocifetch/resolve.d.ts +37 -0
  71. package/dist/ocifetch/resolve.d.ts.map +1 -0
  72. package/dist/ocifetch/resolve.js +90 -0
  73. package/dist/ocifetch/resolve.js.map +1 -0
  74. package/dist/ocifetch/types.d.ts +1 -1
  75. package/dist/ocifetch/types.d.ts.map +1 -1
  76. package/dist/registry.d.ts +64 -3
  77. package/dist/registry.d.ts.map +1 -1
  78. package/dist/registry.js +141 -10
  79. package/dist/registry.js.map +1 -1
  80. package/package.json +1 -1
@@ -15,6 +15,20 @@
15
15
  * 5. loader steps 1-6, once per image; step 7 under the process setup
16
16
  * 6. the image's Library, whose `resolved` is the record that first opened it
17
17
  *
18
+ * registry.fetch(request) (public issue #492)
19
+ * ensure(request, fetch options) for this host, and nothing opened: no
20
+ * image loaded, no setup touched, nothing memoized or in `libraries()`.
21
+ *
22
+ * One fetch per request at a time: an open that misses the cache and may fetch
23
+ * and a `fetch` of the same request share the fetch in progress, and each gets
24
+ * its answer; a failed fetch is never remembered.
25
+ *
26
+ * Every build the registry opens or fetches is held by this process until it
27
+ * exits (`hold`, the shared flock on the entry's `verified.json`), so
28
+ * `chtypes prune` never removes it meanwhile (public issue #494). A build a
29
+ * concurrent prune removed between the lookup and the hold is looked up (or
30
+ * fetched) again, once.
31
+ *
18
32
  * This is the 2.0.0-dev registry: its fetch layer speaks the ABI v2 dev channel
19
33
  * (`./ocifetch/channel.ts`; `spec/abi-v2/docs.md`, rules r5 and r6). A pinning
20
34
  * option (`frozen`, `lockPath`, `lockWrite`, `update`) is refused at
@@ -27,9 +41,39 @@
27
41
  * installed build a floating request means is the fetch layer's.
28
42
  */
29
43
  import { type Library } from './library.js';
30
- import { type FetchV1Options, type Resolved } from './ocifetch/index.js';
31
- /** The fetch layer's options (bases, cache directory, system directories, trusted keys, token, allow-unsigned, offline, frozen, lock path, ...) without its test-only hooks. */
32
- export type FetchOptions = Omit<FetchV1Options, 'beforeIndexRename' | 'httpLog' | 'clock'>;
44
+ import { type Resolved } from './ocifetch/index.js';
45
+ /**
46
+ * What the fetch layer is configured with (`docs/guides/fetch-v1.md`; `docs/reference/bindings-v1.md` §6), under
47
+ * the same names as Go's, Python's and Rust's fields, each falling back to its environment variable and then to
48
+ * the fetch layer's own default. The fetch layer's test hooks are not here, and a registry opens libraries for
49
+ * this host only (`chtypes fetch --platform` names another).
50
+ */
51
+ export interface FetchOptions {
52
+ /** Base URLs, most preferred first; overrides `CHTYPES_ARTIFACTS_URL` and the built-in list. */
53
+ readonly bases?: readonly string[] | undefined;
54
+ /** The cache (`CHTYPES_CACHE`). */
55
+ readonly cacheDir?: string | undefined;
56
+ /** Read-only system directories searched after the cache; undefined is the built-in list, `[]` none. */
57
+ readonly systemDirs?: readonly string[] | undefined;
58
+ /** Raw 32-byte ed25519 public keys, each as 64 hex characters (`CHTYPES_TRUSTED_KEYS`'s spelling); the key id is derived. A non-empty list REPLACES the default trust. */
59
+ readonly trustedKeys?: readonly string[] | undefined;
60
+ /** Proceed, with a warning, when no signed statement verifies (`CHTYPES_ALLOW_UNSIGNED`). */
61
+ readonly allowUnsigned?: boolean | undefined;
62
+ /** Sent as `Authorization: Bearer <token>` to configured base hosts only (`CHTYPES_DOWNLOAD_TOKEN`). */
63
+ readonly token?: string | undefined;
64
+ /** The cache only, no request; on when this is true or `CHTYPES_OFFLINE` is `1` (public issue #528). */
65
+ readonly offline?: boolean | undefined;
66
+ /** Fetch exactly the lock's pinned digests. */
67
+ readonly frozen?: boolean | undefined;
68
+ /** The lock file. */
69
+ readonly lockPath?: string | undefined;
70
+ /** Write (or update) the lock after a successful fetch. */
71
+ readonly lockWrite?: boolean | undefined;
72
+ /** Re-resolve every locked request and rewrite the lock. */
73
+ readonly update?: boolean | undefined;
74
+ /** Strict mode (public issue #486): every fault of the cache and of an existing system dir is a `CacheUnusableError`. Unset reads `CHTYPES_CACHE_STRICT`. */
75
+ readonly strictCache?: boolean | undefined;
76
+ }
33
77
  /**
34
78
  * The cache root a fetch, list or `chtypes where` with `options` would use: `options.cacheDir`, else
35
79
  * `CHTYPES_CACHE` (each used through its `v2-dev` subroot, rule r5 of `spec/abi-v2/docs.md`), else `${XDG_CACHE_HOME:-~/.cache}/chtypes/v2-dev`. It is the
@@ -49,6 +93,13 @@ export interface RegistryOptions {
49
93
  /** Requests opened at construction, in list order. They never fetch, even with autofetch on. */
50
94
  readonly preload?: readonly string[] | undefined;
51
95
  }
96
+ /**
97
+ * Test only: `hook` is called with the request each time an open or a `fetch`
98
+ * of `registry` starts waiting on a fetch, its own or another's, so a test can
99
+ * hold a fetch until every caller it starts is waiting on it, on events rather
100
+ * than a clock. `undefined` removes it. Not part of the public API.
101
+ */
102
+ export declare function onFetchWaitForTests(registry: Registry, hook: ((request: string) => void) | undefined): void;
52
103
  export declare class Registry {
53
104
  #private;
54
105
  private constructor();
@@ -58,6 +109,16 @@ export declare class Registry {
58
109
  for(request: string): Promise<Library>;
59
110
  /** What is installed: the fetch layer's own listing. */
60
111
  installed(): Promise<readonly Resolved[]>;
112
+ /**
113
+ * Resolve, fetch, verify and install the build `request` names into the cache, as `chtypes fetch` does, and open
114
+ * nothing: no library is loaded and the process setup is untouched, so it needs no `setup` (public issue #492). It
115
+ * honors the registry's fetch options (offline, the cache, and under a production channel the bases, the trust and
116
+ * the lock), and it shares one fetch with a concurrent open or `fetch` of the same request. The `Resolved` names the
117
+ * installed version, build, digests and library path. The build is held by this process until it exits, so no
118
+ * `chtypes prune` removes it meanwhile (public issue #494). A refused spelling is a `UsageError`, as for `for`;
119
+ * every other failure is the fetch layer's own error, an `ArtifactError` with its code.
120
+ */
121
+ fetch(request: string): Promise<Resolved>;
61
122
  /** The libraries this registry has opened, in order of first open. */
62
123
  libraries(): readonly Library[];
63
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,cAAc,CAAC;AACvD,OAAO,EAIL,KAAK,cAAc,EAQnB,KAAK,QAAQ,EAKd,MAAM,qBAAqB,CAAC;AAK7B,gLAAgL;AAChL,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;AAE3F;;;;GAIG;AACH,wBAAgB,SAAS,CAAC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AAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,CAG3G;AAED,qBAAa,QAAQ;;IAQnB,OAAO,eAMN;IAED,iKAAiK;IACjK,OAAa,IAAI,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAalE;IAED,uHAAuH;IACjH,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG3C;IAED,wDAAwD;IAClD,SAAS,IAAI,OAAO,CAAC,SAAS,QAAQ,EAAE,CAAC,CAE9C;IAED;;;;;;;;OAQG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAU9C;IAED,sEAAsE;IACtE,SAAS,IAAI,SAAS,OAAO,EAAE,CAE9B;CA6GF"}
package/dist/registry.js CHANGED
@@ -15,6 +15,20 @@
15
15
  * 5. loader steps 1-6, once per image; step 7 under the process setup
16
16
  * 6. the image's Library, whose `resolved` is the record that first opened it
17
17
  *
18
+ * registry.fetch(request) (public issue #492)
19
+ * ensure(request, fetch options) for this host, and nothing opened: no
20
+ * image loaded, no setup touched, nothing memoized or in `libraries()`.
21
+ *
22
+ * One fetch per request at a time: an open that misses the cache and may fetch
23
+ * and a `fetch` of the same request share the fetch in progress, and each gets
24
+ * its answer; a failed fetch is never remembered.
25
+ *
26
+ * Every build the registry opens or fetches is held by this process until it
27
+ * exits (`hold`, the shared flock on the entry's `verified.json`), so
28
+ * `chtypes prune` never removes it meanwhile (public issue #494). A build a
29
+ * concurrent prune removed between the lookup and the hold is looked up (or
30
+ * fetched) again, once.
31
+ *
18
32
  * This is the 2.0.0-dev registry: its fetch layer speaks the ABI v2 dev channel
19
33
  * (`./ocifetch/channel.ts`; `spec/abi-v2/docs.md`, rules r5 and r6). A pinning
20
34
  * option (`frozen`, `lockPath`, `lockWrite`, `update`) is refused at
@@ -27,13 +41,45 @@
27
41
  * installed build a floating request means is the fetch layer's.
28
42
  */
29
43
  import os from 'node:os';
30
- import { LoaderCorruptError, openAbi2 } from './abi2/index.js';
44
+ import { corruptRefusal, openAbi2 } from './abi2/index.js';
31
45
  import { usageError } from './abi2/index.js';
32
46
  import { libraryOf } from './library.js';
33
- import { ArtifactMissingError, cacheRoot as fetchCacheRoot, ensure, hostPlatformKey, isFilesystemError, listInstalled, missingNotes, PinningRefusedError, refusePinning, resolveInstalled, satisfiesRequest, searchDirs as fetchSearchDirs, withNotes, } from './ocifetch/index.js';
47
+ import { activeChannel, ArtifactMissingError, cacheRoot as fetchCacheRoot, ensure, hold, hostPlatformKey, isFilesystemError, listInstalled, missingNotes, PinningRefusedError, refusePinning, removedWhileHeld, resolveInstalled, satisfiesRequest, searchDirs as fetchSearchDirs, withNotes, } from './ocifetch/index.js';
34
48
  import { ENV_AUTOFETCH_NAME, SPELLING_REGEX } from './ocifetch/constants.gen.js';
35
- import { withEnvironment } from './env.js';
49
+ import { trustedKeysOfHex, withEnvironment } from './env.js';
36
50
  import { commitSetup, latchSetup, settleFailedOpen, setupGeneration } from './setup.js';
51
+ /** The public options as the fetch layer's own: each set field copied, and the trusted keys read from hex. */
52
+ function fetchLayerOptions(options = {}) {
53
+ const out = {};
54
+ if (options.bases !== undefined)
55
+ out.bases = options.bases;
56
+ if (options.cacheDir !== undefined)
57
+ out.cacheDir = options.cacheDir;
58
+ if (options.systemDirs !== undefined)
59
+ out.systemDirs = options.systemDirs;
60
+ if (options.trustedKeys !== undefined) {
61
+ // A channel that honors no trust override ignores the option, with its one
62
+ // warning, whatever it holds (rule r6), as every binding does.
63
+ out.trustedKeys = activeChannel().overridable ? trustedKeysOfHex(options.trustedKeys, 'the trustedKeys option') : [];
64
+ }
65
+ if (options.allowUnsigned !== undefined)
66
+ out.allowUnsigned = options.allowUnsigned;
67
+ if (options.token !== undefined)
68
+ out.token = options.token;
69
+ if (options.offline !== undefined)
70
+ out.offline = options.offline;
71
+ if (options.frozen !== undefined)
72
+ out.frozen = options.frozen;
73
+ if (options.lockPath !== undefined)
74
+ out.lockPath = options.lockPath;
75
+ if (options.lockWrite !== undefined)
76
+ out.lockWrite = options.lockWrite;
77
+ if (options.update !== undefined)
78
+ out.update = options.update;
79
+ if (options.strictCache !== undefined)
80
+ out.strictCache = options.strictCache;
81
+ return out;
82
+ }
37
83
  /**
38
84
  * The cache root a fetch, list or `chtypes where` with `options` would use: `options.cacheDir`, else
39
85
  * `CHTYPES_CACHE` (each used through its `v2-dev` subroot, rule r5 of `spec/abi-v2/docs.md`), else `${XDG_CACHE_HOME:-~/.cache}/chtypes/v2-dev`. It is the
@@ -48,7 +94,7 @@ export function cacheRoot(options = {}) {
48
94
  * the fetch layer's own, and on a tie the earlier directory wins. It creates nothing and touches no file.
49
95
  */
50
96
  export function searchDirs(options = {}) {
51
- return fetchSearchDirs(options);
97
+ return fetchSearchDirs(fetchLayerOptions(options));
52
98
  }
53
99
  function envFlag(name) {
54
100
  const v = process.env[name];
@@ -60,19 +106,38 @@ function checkSpelling(request) {
60
106
  throw usageError(`${JSON.stringify(request)} is not a version spelling: give two, three or four dotted parts (26.8, 26.8.15, 26.8.15.10), with no "v" prefix and no channel suffix`);
61
107
  }
62
108
  }
109
+ /** The test hook a registry calls each time an open or a `fetch` starts waiting on a fetch, its own or another's; see `onFetchWaitForTests`. */
110
+ const fetchWaitHooks = new WeakMap();
111
+ /**
112
+ * Test only: `hook` is called with the request each time an open or a `fetch`
113
+ * of `registry` starts waiting on a fetch, its own or another's, so a test can
114
+ * hold a fetch until every caller it starts is waiting on it, on events rather
115
+ * than a clock. `undefined` removes it. Not part of the public API.
116
+ */
117
+ export function onFetchWaitForTests(registry, hook) {
118
+ if (hook === undefined)
119
+ fetchWaitHooks.delete(registry);
120
+ else
121
+ fetchWaitHooks.set(registry, hook);
122
+ }
63
123
  export class Registry {
64
124
  #fetch;
65
125
  #autofetch;
66
126
  #memo = new Map();
67
127
  #opened = [];
128
+ /** The fetches in progress, by request: every open that misses the cache and every `fetch` of the request waits on the one there. */
129
+ #fetches = new Map();
68
130
  constructor(options) {
69
- this.#fetch = withEnvironment(options.fetch ?? {});
131
+ // The environment fills what the caller left unset. CHTYPES_TARGET names
132
+ // `chtypes fetch`'s platform, never a registry's: it opens for this host.
133
+ const { platform: _cliOnly, ...fetch } = withEnvironment(fetchLayerOptions(options.fetch));
134
+ this.#fetch = fetch;
70
135
  this.#autofetch = options.autofetch ?? envFlag(ENV_AUTOFETCH_NAME);
71
136
  }
72
137
  /** Construct a registry. It opens nothing, except each `preload` request, in list order. A pinning fetch option is refused here, as a `UsageError` (rule r6). */
73
138
  static async open(options = {}) {
74
139
  try {
75
- refusePinning(options.fetch ?? {});
140
+ refusePinning(fetchLayerOptions(options.fetch));
76
141
  }
77
142
  catch (err) {
78
143
  if (err instanceof PinningRefusedError)
@@ -95,6 +160,27 @@ export class Registry {
95
160
  async installed() {
96
161
  return listInstalled(this.#fetch);
97
162
  }
163
+ /**
164
+ * Resolve, fetch, verify and install the build `request` names into the cache, as `chtypes fetch` does, and open
165
+ * nothing: no library is loaded and the process setup is untouched, so it needs no `setup` (public issue #492). It
166
+ * honors the registry's fetch options (offline, the cache, and under a production channel the bases, the trust and
167
+ * the lock), and it shares one fetch with a concurrent open or `fetch` of the same request. The `Resolved` names the
168
+ * installed version, build, digests and library path. The build is held by this process until it exits, so no
169
+ * `chtypes prune` removes it meanwhile (public issue #494). A refused spelling is a `UsageError`, as for `for`;
170
+ * every other failure is the fetch layer's own error, an `ArtifactError` with its code.
171
+ */
172
+ async fetch(request) {
173
+ checkSpelling(request); // misuse, refused before anything is attempted
174
+ if (hostPlatformKey(os.platform(), os.arch()) === undefined) {
175
+ throw new ArtifactMissingError(`chtypes: no artifact is published for this host (${os.platform()}-${os.arch()})`);
176
+ }
177
+ try {
178
+ return await this.#ensureHeld(request);
179
+ }
180
+ catch (err) {
181
+ throw typedFilesystemError(err);
182
+ }
183
+ }
98
184
  /** The libraries this registry has opened, in order of first open. */
99
185
  libraries() {
100
186
  return [...this.#opened];
@@ -118,15 +204,15 @@ export class Registry {
118
204
  return opening;
119
205
  }
120
206
  async #openRequest(request, mayFetch) {
121
- const platform = this.#fetch.platform ?? hostPlatformKey(os.platform(), os.arch());
207
+ const platform = hostPlatformKey(os.platform(), os.arch());
122
208
  if (platform === undefined) {
123
209
  throw new ArtifactMissingError(`chtypes: no artifact is published for this host (${os.platform()}-${os.arch()})`);
124
210
  }
125
211
  let resolved;
126
212
  try {
127
- resolved = await resolveInstalled(request, platform, this.#fetch);
213
+ resolved = await this.#lookupHeld(request, platform);
128
214
  if (resolved === undefined && mayFetch)
129
- resolved = await ensure(request, this.#fetch);
215
+ resolved = await this.#ensureHeld(request);
130
216
  }
131
217
  catch (err) {
132
218
  throw typedFilesystemError(err);
@@ -149,7 +235,7 @@ export class Registry {
149
235
  // own build_info must report a version within the request, whatever the
150
236
  // cache answered. The image stays loaded for the requests it does answer.
151
237
  if (!satisfiesRequest(request, library.version)) {
152
- throw new LoaderCorruptError({
238
+ throw corruptRefusal({
153
239
  reason: 'build_info_mismatch:clickhouse_version',
154
240
  path: resolved.libraryPath,
155
241
  want: request,
@@ -158,6 +244,51 @@ export class Registry {
158
244
  }
159
245
  return library;
160
246
  }
247
+ /**
248
+ * The installed lookup, then this process's hold on the build it found (`hold`), taken before anything reads the
249
+ * library. A build a concurrent prune removed between the two is looked up again, once; removed twice, it is a
250
+ * miss.
251
+ */
252
+ async #lookupHeld(request, platform) {
253
+ for (let attempt = 0; attempt < 2; attempt++) {
254
+ const resolved = await resolveInstalled(request, platform, this.#fetch);
255
+ if (resolved === undefined)
256
+ return undefined;
257
+ if (hold(resolved.dir) !== 'vanished')
258
+ return resolved;
259
+ }
260
+ return undefined;
261
+ }
262
+ /**
263
+ * The request's one fetch (`#ensure`), then this process's hold on the build it installed. A build a concurrent
264
+ * prune removed between the two is fetched again, once; removed twice, it is `ArtifactMissingError`.
265
+ */
266
+ async #ensureHeld(request) {
267
+ for (let attempt = 0;; attempt++) {
268
+ const resolved = await this.#ensure(request);
269
+ if (hold(resolved.dir) !== 'vanished')
270
+ return resolved;
271
+ if (attempt === 1)
272
+ throw removedWhileHeld(request, resolved.dir);
273
+ }
274
+ }
275
+ /**
276
+ * Joins the fetch in progress for `request`, or starts it: every caller waiting on it gets its answer, and it
277
+ * leaves the table as it settles, so a failed fetch is never remembered and the next caller starts a new one.
278
+ */
279
+ #ensure(request) {
280
+ let flight = this.#fetches.get(request);
281
+ if (flight === undefined) {
282
+ const started = ensure(request, this.#fetch).finally(() => {
283
+ if (this.#fetches.get(request) === started)
284
+ this.#fetches.delete(request);
285
+ });
286
+ this.#fetches.set(request, started);
287
+ flight = started;
288
+ }
289
+ fetchWaitHooks.get(this)?.(request);
290
+ return flight;
291
+ }
161
292
  }
162
293
  /**
163
294
  * A filesystem failure in the fetch layer (an unwritable or full cache) as
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAgB,SAAS,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,oBAAoB,EACpB,SAAS,IAAI,cAAc,EAC3B,MAAM,EAEN,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,mBAAmB,EAEnB,aAAa,EAEb,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,IAAI,eAAe,EAC7B,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,U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AK,CAAC;gBAAE,MAAM,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,OAAe;QACrB,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,OAAO,GAAsB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;gBAC3E,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,OAAO;oBAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACpC,MAAM,GAAG,OAAO,CAAC;QACnB,CAAC;QACD,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,GAAY;IACxC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACxC,OAAO,UAAU,CAAC,oDAAoD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;AACvF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavehouse/chtypes",
3
- "version": "2.0.0-dev.5",
3
+ "version": "2.0.0-dev.7",
4
4
  "description": "ClickHouse's own type system, per version, over the frozen chs_* C ABI",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",