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