@@ -378,16 +378,18 @@ to that effect within the initial result, while the `pending` entry for
378
378
379
379
Delivery group nodes may have three different types of child nodes:
380
380
381
- 1 . Other delivery group nodes, i.e. the node representing ` SlowFragment ` should
381
+ 1 . Child Delivery Group nodes, i.e. the node representing ` SlowFragment ` should
382
382
have a child node representing ` SlowestFragment ` .
383
- 2 . Pending incremental data nodes, i.e. the node for ` SlowFragment ` should
383
+ 2 . Pending Incremental Data nodes, i.e. the node for ` SlowFragment ` should
384
384
initially have a node for ` slowField ` .
385
- 3 . Completed incremental data nodes, i.e. when ` slowField ` is completed, the
385
+ 3 . Completed Incremental Data nodes, i.e. when ` slowField ` is completed, the
386
386
pending incremental data node for ` slowField ` should be replaced with a node
387
387
representing the completed data.
388
388
389
389
The {YieldIncrementalResults()} algorithm is responsible for updating the graph
390
- as it yields the incremental results.
390
+ as it yields the incremental results. When a delivery group contains only
391
+ completed incremental data nodes, the group is removed from the graph as it is
392
+ delivered.
391
393
392
394
YieldIncrementalResults(data, errors, incrementalDataRecords):
393
395
@@ -413,7 +415,7 @@ YieldIncrementalResults(data, errors, incrementalDataRecords):
413
415
- Let {resultIncrementalDataRecords} be {incrementalDataRecords} on {result}.
414
416
- Update {graph} to {GraphFromRecords(resultIncrementalDataRecords, graph)}.
415
417
- Let {completedDeferredFragments} be the set of root nodes in {graph} without
416
- any child Pending Data nodes.
418
+ any child Pending Incremental Data nodes.
417
419
- Let {completedIncrementalDataNodes} be the set of completed Incremental Data
418
420
nodes that are children of {completedDeferredFragments}.
419
421
- If {completedIncrementalDataNodes} is empty, continue to the next completed
@@ -438,17 +440,39 @@ YieldIncrementalResults(data, errors, incrementalDataRecords):
438
440
pending)}.
439
441
- Complete this incremental result stream.
440
442
443
+ New Incremental Data Records are added to the {graph} by the
444
+ {GraphFromRecords()} algorithm as Pending Incremental Data nodes directed from
445
+ the Deferred Fragments they incrementally complete.
446
+
441
447
GraphFromRecords(incrementalDataRecords, graph):
442
448
443
449
- If {graph} is not provided, initialize to an empty graph.
444
450
- Let {newGraph} be a new directed acyclic graph containing all of the nodes and
445
451
edges in {graph}.
446
452
- For each {incrementalDataRecord} of {incrementalDataRecords}:
447
- - Add {incrementalDataRecord} to {newGraph} as a new Pending Data node
448
- directed from the {pendingResults} that it completes, adding each of
449
- {pendingResults} to {newGraph} as a new node directed from its {parent},
450
- recursively adding each {parent} until {incrementalDataRecord} is connected
451
- to {newGraph}, or the {parent} is not defined.
453
+ - Let {deferredFragments} be the Deferred Fragments incrementally completed by
454
+ {incrementalDataRecord}.
455
+ - For each {deferredFragment} of {deferredFragments}:
456
+ - Reset {newGraph} to the result of
457
+ {GraphWithDeferredFragmentRecord(deferredFragment, newGraph)}.
458
+ - Add {incrementalDataRecord} to {newGraph} as a new Pending Incremental Data
459
+ node directed from the {deferredFragments} that it completes.
460
+ - Return {newGraph}.
461
+
462
+ The {GraphWithDeferredFragmentRecord()} algorithm returns a new graph containing
463
+ the provided Deferred Fragment Record, recursively adding its parent Deferred
464
+ Fragment nodes.
465
+
466
+ GraphWithDeferredFragmentRecord(deferredFragment, graph):
467
+
468
+ - If {graph} contains a Deferred Fragment node representing {deferredFragment},
469
+ return {graph}.
470
+ - Let {parent} be the parent Deferred Fragment of {deferredFragment}.
471
+ - If {parent} is defined, let {newGraph} be the result of
472
+ {GraphWithDeferredFragmentRecord(parent, graph)}; otherwise, let {newGraph} be
473
+ a new directed acyclic graph containing all of the nodes and edges in {graph}.
474
+ - Add {deferredFragment} to {newGraph} as a new Deferred Fragment node directed
475
+ from {parent}, if defined.
452
476
- Return {newGraph}.
453
477
454
478
The {GetNewRootNodes()} algorithm is responsible for determining the new root
0 commit comments