@procedures/mongo 0.36.0 → 0.37.0

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.
@@ -33,6 +33,8 @@
33
33
  * 1000 rows. It keeps nothing between passes.
34
34
  * - A change stream that ends (for example after `dropDatabase`) opens again after `rewatch`,
35
35
  * and a pass catches up on the changes that the stream missed.
36
+ * - Each stream is open on the server before the materializer reads what it watches: the views
37
+ * before the read of the views, the sources before a run. A change between the two reaches both.
36
38
  * - The status of each view (`ok`, `errored`, `cycle`) goes into the field `statusField` of its
37
39
  * document. The materializer ignores an update of only that field.
38
40
  *
@@ -44,14 +46,16 @@
44
46
  * that moves a document to another partition also reaches the views of its old partition.
45
47
  *
46
48
  * Change streams and transactions need a replica set (MongoDB 6 or later). The target of a view is
47
- * a plain collection that only the materializer writes.
49
+ * a plain collection that only the materializer writes. A target of `storageTargets` is in the
50
+ * stored form of a `MongoDocumentStorage` instead (roadmap CLI-81): see `ViewStorageTarget`.
48
51
  *
49
52
  * The stop has the parts of a transport of a service: `stopIntake()`, `drain()`, `inFlight()` and
50
53
  * `close()`. A host composes them with no adapter. The timers come from the injected clock.
51
54
  */
52
55
  import { ObjectId, type Db, type Document } from "mongodb";
53
56
  import { type Clock, type Duration } from "@procedures/client";
54
- import { type StoredForm } from "./document-storage.js";
57
+ import { MongoDocumentStorage, type StoredForm } from "./document-storage.js";
58
+ import type { StorageHintPublisher } from "./storage-hints.js";
55
59
  /** The definition of a view, as a document of the views collection. */
56
60
  export interface MaterializedView {
57
61
  _id: string;
@@ -152,6 +156,79 @@ export interface ViewMaterializerOptions {
152
156
  * When the form or the function gives `undefined`, the change reaches the views of each partition.
153
157
  */
154
158
  storageSources?: Readonly<Record<string, ViewPartitionOf | ViewStorageSource>> | undefined;
159
+ /**
160
+ * The targets in the stored form of a `MongoDocumentStorage` (roadmap CLI-81), by the name of the
161
+ * target collection: the storage of the target, its stored form, or a `ViewStorageTarget`. The
162
+ * rows of such a target are documents of the storage, so a reader reads them through a
163
+ * `MongoDocumentStorage` with the same form, and `changes(since)` and `watchStorageChanges()`
164
+ * have each write of a run. See `ViewStorageTarget` for the rules. Give the same targets to each
165
+ * materializer of the views.
166
+ *
167
+ * A function gives the entry of a target collection at each run, or undefined for a target that
168
+ * is not in a stored form: an app can name its targets at run time. The materializer keeps the
169
+ * storage that it makes for a collection while the entry gives the same form, counters,
170
+ * `writeLease` and `maxTombstones`. An error of the function is an error of the view.
171
+ */
172
+ storageTargets?: Readonly<Record<string, ViewStorageTargetEntry>> | ((collection: string) => ViewStorageTargetEntry | undefined) | undefined;
173
+ /**
174
+ * The id of a row of a target in a stored form, from the `_id` of the row in the result. It must
175
+ * give a text, and give the same text for the same `_id` at each run.
176
+ * @default `defaultStorageRowId`: a text as it is, another value as its relaxed Extended JSON text
177
+ */
178
+ storageRowIdOf?: ((id: unknown) => string) | undefined;
179
+ /**
180
+ * The publisher of the hints of the targets that are not in `storageTargets`, for example the bus
181
+ * of the procedures. After each run that changes rows, the materializer publishes one hint with
182
+ * the ids of the changed rows and of the removed rows. A change of generation, a row id that is
183
+ * not a text and more than 10000 ids give a reset hint (`reset: true`): the subscribers read the
184
+ * view in full. The materializer publishes no hint of a target in a stored form: a watcher of
185
+ * the storage (`watchStorageChanges()`) does.
186
+ */
187
+ publish?: StorageHintPublisher | undefined;
188
+ /** The topic of the hints of a view, or undefined for no hint (default `collectionChangeTopic(view._id)`). */
189
+ hintTopic?: ((view: MaterializedView, partition: string) => string | undefined) | undefined;
190
+ /**
191
+ * The `_id` of a row in the result, from its stored `_id`, for the ids of a hint. It reverses
192
+ * `targetId`. The default reads the field `id` of the form of `partitionTargetId`.
193
+ */
194
+ rowIdOf?: ((storedId: unknown) => unknown) | undefined;
195
+ }
196
+ /**
197
+ * A storage with items of any type. The type of the items does not change the stored form, and a
198
+ * `MongoDocumentStorage<T>` of a given `T` is not a `MongoDocumentStorage<unknown>`.
199
+ */
200
+ type AnyDocumentStorage = MongoDocumentStorage<any>;
201
+ /** An entry of `storageTargets`: the storage of a target, its stored form, or a `ViewStorageTarget`. */
202
+ export type ViewStorageTargetEntry = AnyDocumentStorage | StoredForm | ViewStorageTarget;
203
+ /**
204
+ * A target of `storageTargets` (roadmap CLI-81).
205
+ *
206
+ * - The rows are documents of the storage: each row gets `_key`, `_seq`, `_ord`, the partition
207
+ * fields of the form, and `_kid`, `_kpf` or `_json` as a write of the storage makes them. The
208
+ * materializer encodes each row from its own content: the fields of a storage in a row (for
209
+ * example of a source document that the pipeline passes through) do not go into the target.
210
+ * - The id of a row is `storageRowIdOf(_id)`: by default the `_id` of the row when it is a text,
211
+ * else its relaxed Extended JSON text (`null` gives `"null"`, `5` gives `"5"`, an ObjectId gives
212
+ * `{"$oid":"…"}`). The item has that id as its `_id`. Two rows of a result must not have the
213
+ * same id.
214
+ * - A row also gets the partition field of the materializer with the partition of the view, so a
215
+ * view that reads the target finds it. When that field is a partition field of the form, the
216
+ * form must give it the partition of the view.
217
+ * - A run takes the numbers of its writes from the sequence of the storage, and a late run moves
218
+ * to new numbers, as a write of the storage does. A removed row becomes a tombstone, and the
219
+ * prune of the tombstones raises the floor of the change log.
220
+ * - A partition of the storage holds only the rows of one view. The run makes a tombstone of each
221
+ * other live document in that partition. The materializer refuses a second view of the same
222
+ * target collection and partition of the storage: that view has an error.
223
+ * - The materializer gives the target no images before the change. Turn on
224
+ * `changeStreamPreAndPostImages` on the target when raw hard deletes can occur.
225
+ * - The rows have no generation, so `viewFilter()` and a `MongoViewStorage` do not read them.
226
+ */
227
+ export interface ViewStorageTarget {
228
+ /** The storage of the target, or its stored form. The materializer writes with its own database, and takes the counters, `writeLease` and `maxTombstones` of a storage. */
229
+ target: AnyDocumentStorage | StoredForm;
230
+ /** The partition of the storage from the partition of a view (default the same partition). Undefined is the storage without a partition. */
231
+ storagePartitionOf?: ((viewPartition: string) => string | undefined) | undefined;
155
232
  }
156
233
  /** The function that gives the stored `_id` of a row of a view. */
157
234
  export type ViewTargetId = (id: unknown, partition: string, generation: ObjectId) => unknown;
@@ -170,6 +247,15 @@ export declare function viewFilter(view: MaterializedView, options?: {
170
247
  partitionField?: string | undefined;
171
248
  statusField?: string | undefined;
172
249
  }): Document;
250
+ /** The `_id` of a row in the result, from the stored `_id` of `partitionTargetId`. */
251
+ export declare function defaultRowId(storedId: unknown): unknown;
252
+ /**
253
+ * The id of a row of a target in a stored form, from the `_id` of the row in the result: a text as
254
+ * it is, another value as its relaxed Extended JSON text. The text of a value is the same at each
255
+ * run (the order of the fields of an object is the order of the result). A row without `_id` has
256
+ * no id.
257
+ */
258
+ export declare function defaultStorageRowId(id: unknown): string;
173
259
  /** The function that gives the partition of the views from the partition of a storage, or `undefined` when it does not know. */
174
260
  export type ViewPartitionOf = (storagePartition: string) => string | undefined;
175
261
  /** The partition of the views is the partition of the storage. */
@@ -215,13 +301,29 @@ export declare class ViewMaterializer {
215
301
  private readonly graceMs;
216
302
  private readonly leaseMs;
217
303
  private readonly storageSources;
304
+ /** The storages that the materializer made for the targets in a stored form, by collection, with the values that made them. */
305
+ private readonly storageTargetCache;
306
+ /** The partition of a storage target that each running view writes (by the key of the view), so a second view of it is refused. */
307
+ private readonly storageClaims;
308
+ private readonly storageRowIdOf;
309
+ private readonly rowIdOf;
218
310
  /** False after `stopIntake()`: a change starts no pass. */
219
311
  private intake;
220
312
  /** The work of each partition, one at a time: the passes and the rebalances. */
221
313
  private readonly chains;
222
314
  private readonly pending;
315
+ /** The changes of the set of views (a resync, a change of a view document), one at a time, in the order of the views stream. */
316
+ private viewChain;
223
317
  private stopped;
224
318
  constructor(options: ViewMaterializerOptions);
319
+ /**
320
+ * A target of `storageTargets` as a storage on the database of the materializer, so its writes
321
+ * and the transaction of a run use one client. A given storage gives its form, its counters,
322
+ * `writeLease` and `maxTombstones`.
323
+ */
324
+ private storageTargetOf;
325
+ /** The target in a stored form of a collection at this time, or undefined. The function of `storageTargets` runs at each call. */
326
+ private storageTargetFor;
225
327
  private log;
226
328
  /**
227
329
  * The guard of a pipeline of a view. A target of another view counts only in its current
@@ -258,11 +360,23 @@ export declare class ViewMaterializer {
258
360
  private serial;
259
361
  private keyOf;
260
362
  private partitionOf;
261
- /** This method closes each view, and opens each view of the views collection again: a full catch-up. */
363
+ /**
364
+ * This method runs a change of the set of views after the changes before it. A change of a view
365
+ * document that comes during a resync thus applies after the read of the resync, not before it.
366
+ */
367
+ private inViewOrder;
368
+ /**
369
+ * This method closes each view, and opens each view of the views collection again: a full
370
+ * catch-up. Open the stream of the views first: then a change after the read reaches the stream.
371
+ */
262
372
  private resync;
373
+ /** This method opens the stream of the views. The promise resolves when the stream is open on the server. */
263
374
  private watchViews;
264
375
  private onViewChange;
265
- private spinUp;
376
+ /** This method adds a view to the views that the materializer knows. It gives false for a view that cannot run. */
377
+ private register;
378
+ /** This method makes the index of the target of a registered view, and rebalances its partition: a new view runs. */
379
+ private activate;
266
380
  private tearDown;
267
381
  /**
268
382
  * The filter of the change stream of a source for a partition. It only removes the events that
@@ -297,6 +411,7 @@ export declare class ViewMaterializer {
297
411
  */
298
412
  private isOtherPartition;
299
413
  private isCurrent;
414
+ /** This method opens the stream of a source for a view. The promise resolves when the stream is open on the server. */
300
415
  private watchSource;
301
416
  /** This method runs a function after `rewatch`, unless the materializer stops. The timer does not keep the process alive. */
302
417
  private later;
@@ -315,6 +430,14 @@ export declare class ViewMaterializer {
315
430
  * its target run after it, in the same pass.
316
431
  */
317
432
  private run;
433
+ /** This method waits on the clock of the materializer. The timer does not keep the process alive. */
434
+ private pause;
435
+ /**
436
+ * The storage of the partition of a view in its target, or undefined for a target that is not in
437
+ * `storageTargets`. A partition that the storage refuses, and a partition field of the form with
438
+ * another value than the partition of the view, are an error of the view.
439
+ */
440
+ private targetPartition;
318
441
  /**
319
442
  * The status of a view in the database (the current generation, and the previous one), and the
320
443
  * time of the server: the times of the generations are times of the server.
@@ -330,6 +453,15 @@ export declare class ViewMaterializer {
330
453
  private dropOldGenerations;
331
454
  /** The rows of the result, in groups of 1000. A failure of the pipeline, a row without `_id` and too many rows are a `ViewRunError`. */
332
455
  private resultGroups;
456
+ /**
457
+ * A row of the result as a document of a target in a stored form (roadmap CLI-81). The content is
458
+ * the row without the fields of the materializer and of a storage: a pass-through row of a source
459
+ * in a stored form loses its `_key`, `_kid`, `_kpf`, `_ord` and `_json`, and the encoding of the
460
+ * storage makes them again from the row (`_json` from the content of the row). A field of the row
461
+ * with the name of a partition field of the form takes the value of the partition of the target.
462
+ * The numbers (`_seq`, `_ord`) come at the write.
463
+ */
464
+ private storageRowOf;
333
465
  private replaceOf;
334
466
  /**
335
467
  * A run in one transaction, in the current generation (a new one at the first run): the rows that
@@ -342,12 +474,56 @@ export declare class ViewMaterializer {
342
474
  * dirty in the other process, so its next pass computes the view again, and the view converges.
343
475
  */
344
476
  private runInTransaction;
477
+ /**
478
+ * This method publishes the hint of a run of a target that is not in a stored form: one hint
479
+ * for the run, with the ids of the changed rows and of the removed rows. Without ids (a change
480
+ * of generation), with an id that is not a text, or with more than `MAX_HINT_IDS` ids, it is a
481
+ * reset hint. A failure of the publisher goes to the log: the run does not fail.
482
+ */
483
+ private publishHint;
345
484
  /**
346
485
  * A run in groups, outside a transaction: a whole new generation, then the change of the status to
347
486
  * it. The readers of `viewFilter` move to it at once. The rows of no generation go at once: no
348
487
  * reader of a generation reads them.
349
488
  */
350
489
  private runInGroups;
490
+ /**
491
+ * The rows of a group that a run writes in a target in a stored form: each row whose stored
492
+ * document is absent, is a tombstone, or has other content (the numbers do not count). A row
493
+ * keeps the place (`_ord`) of its live stored document. Two rows with the same `_id` in a result
494
+ * are an error of the view.
495
+ */
496
+ private storageWrites;
497
+ /**
498
+ * The live documents of the partition of a view in a target in a stored form that the result
499
+ * does not have. A document whose id the result does not have becomes the tombstone of that id. A
500
+ * document that tells no id, or the id of a row of the result (under another stored `_id`),
501
+ * becomes a tombstone without `_key`: no reader reads a delete of an item from it. More than
502
+ * `limit` documents is an error, so a transaction goes in groups.
503
+ */
504
+ private storageRemovals;
505
+ /**
506
+ * The writes of a target in a stored form with their numbers from `first`: the tombstones first,
507
+ * then the rows. A new row takes its own number as its place. The filter of a write holds the
508
+ * partition: a row of another partition of the view fails with a duplicate key.
509
+ */
510
+ private storageOperations;
511
+ /**
512
+ * A run of a target in a stored form in one transaction (roadmap CLI-81): the rows that changed,
513
+ * and a tombstone for each row that the result does not have. The numbers are pending numbers of
514
+ * the storage: the run takes them after its reads, writes with them in the transaction, and ends
515
+ * them after the commit. A late run moves its documents to new numbers. The transaction does not
516
+ * write the counters, so the writes of the storage do not conflict with it.
517
+ */
518
+ private runStorageInTransaction;
519
+ /**
520
+ * A run of a target in a stored form in groups, outside a transaction (roadmap CLI-81): the rows
521
+ * of each group that changed, then the tombstones of the rows that the result does not have, with
522
+ * the pending numbers of the storage. The run writes in place, so a reader can see a part of it.
523
+ * It holds the lease of the view, and renews it after each group. The first run names a
524
+ * generation in the status of the view: the mark of a view that ran.
525
+ */
526
+ private runStorageInGroups;
351
527
  /** True while the view is the one that the materializer runs for this key. */
352
528
  private isCurrentView;
353
529
  /**
@@ -366,4 +542,5 @@ export declare class ViewMaterializer {
366
542
  /** This method writes the state of a view. It keeps the generations of the status. */
367
543
  private writeStatus;
368
544
  }
545
+ export {};
369
546
  //# sourceMappingURL=materializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"materializer.d.ts","sourceRoot":"","sources":["../../src/storage/materializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAGH,OAAO,EAAQ,QAAQ,EAA0D,KAAK,EAAE,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzH,OAAO,EAAsC,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAM9F,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IA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