@@ -343,10 +343,8 @@ Results that preclude their data from being sent.
343343The Incremental Publisher provides an asynchronous iterator that resolves to the
344344Subsequent Result stream.
345345
346- Both the Execution algorithms and the Incremental Publisher service utilize
347- Incremental Result and Data Records to store required information. The records
348- are detailed below, including which entries are required for Execution itself
349- and which are required by the Incremental Publisher.
346+ The Incremental Publisher service utilizes Incremental Result and Data Records
347+ to store required information. The records are described in detail below.
350348
351349### Incremental Delivery Records
352350
@@ -382,16 +380,11 @@ or a Stream Items Record.
382380
383381An Initial Result Record is a structure containing:
384382
385- - {id}: an implementation-specific value uniquely identifying this record,
386- created if not provided.
383+ - {id}: an implementation-specific value uniquely identifying this record.
387384
388385A Deferred Fragment Record is a structure that always contains:
389386
390- - {id}: an implementation-specific value uniquely identifying this record,
391- created if not provided.
392-
393- Within the Incremental Publisher context, records of this type also include:
394-
387+ - {id}: an implementation-specific value uniquely identifying this record.
395388- {label}: value derived from the corresponding ` @defer ` directive.
396389- {path}: a list of field names and indices from root to the location of the
397390 corresponding ` @defer ` directive.
@@ -404,11 +397,7 @@ Within the Incremental Publisher context, records of this type also include:
404397
405398A Stream Items Record is a structure that always contains:
406399
407- - {id}: an implementation-specific value uniquely identifying this record,
408- created if not provided.
409-
410- Within the Incremental Publisher context, records of this type also include:
411-
400+ - {id}: an implementation-specific value uniquely identifying this record.
412401- {path}: a list of field names and indices from root to the location of the
413402 corresponding list item contained by this Stream Items Record.
414403- {stream}: the Stream Record which this Stream Items Record partially fulfills.
@@ -423,11 +412,7 @@ Within the Incremental Publisher context, records of this type also include:
423412
424413A Stream Record is a structure that always contains:
425414
426- - {id}: an implementation-specific value uniquely identifying this record,
427- created if not provided.
428-
429- Within the Incremental Publisher context, records of this type also include:
430-
415+ - {id}: an implementation-specific value uniquely identifying this record.
431416- {label}: value derived from the corresponding ` @stream ` directive.
432417- {path}: a list of field names and indices from root to the location of the
433418 corresponding ` @stream ` directive.
@@ -445,11 +430,7 @@ Grouped Field Set Record or a Stream Items Record.
445430
446431A Deferred Grouped Field Set Record is a structure that always contains:
447432
448- - {id}: an implementation-specific value uniquely identifying this record,
449- created if not provided.
450-
451- Within the Incremental Publisher context, records of this type also include:
452-
433+ - {id}: an implementation-specific value uniquely identifying this record.
453434- {path}: a list of field names and indices from root to the location of this
454435 deferred grouped field set.
455436- {deferredFragments}: a set of Deferred Fragment Records containing this
@@ -918,7 +899,7 @@ CreateIncrementalPublisher():
918899 - Remove the event from the queue.
919900 - Call {HandleExecutionEvent(eventType, eventDetails)}.
920901 - Wait for the next event or for {allResultsCompleted} to be set to {true}.
921- - If {allResultsCompleted} is {true}, return.
902+ - If {allResultsCompleted} is {true}, return.
922903 - In parallel, set {subsequentResults} on {incrementalPublisher} to the result
923904 of lazily executing {YieldSubsequentResults()}.
924905
@@ -1023,19 +1004,19 @@ serial):
10231004- Let {groupedFieldSet} and {groupDetailsMap} be the result of calling
10241005 {BuildGroupedFieldSets(fieldsByTarget, targetsByKey)}.
10251006- Let {incrementalPublisher} be the result of {CreateIncrementalPublisher()}.
1026- - Let {initialResultRecord} be a new Initial Result Record .
1007+ - Initialize {initialResultId} to an identifier unique to this execution .
10271008- Let {newDeferMap} be the result of {AddNewDeferFragments(incrementalPublisher,
1028- newDeferUsages, initialResultRecord )}.
1009+ newDeferUsages, initialResultId )}.
10291010- Let {detailsList} be the result of
10301011 {AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
10311012 newDeferMap)}.
10321013- Let {data} be the result of running {ExecuteGroupedFieldSet(groupedFieldSet,
10331014 queryType, initialValue, variableValues, incrementalPublisher,
1034- initialResultRecord )} _ serially_ if {serial} is {true}, _ normally_ (allowing
1015+ initialResultId )} _ serially_ if {serial} is {true}, _ normally_ (allowing
10351016 parallelization) otherwise.
10361017- In parallel, call {ExecuteDeferredGroupedFieldSets(queryType, initialValues,
10371018 variableValues, incrementalPublisher, detailsList, newDeferMap)}.
1038- - Let {id} be the corresponding entry on {initialResultRecord }.
1019+ - Let {id} be the corresponding entry on {initialResultId }.
10391020- Let {errors} be the list of all _ field error_ raised while executing the
10401021 {groupedFieldSet}.
10411022- Initialize {initialResult} to an empty unordered map.
@@ -1052,8 +1033,8 @@ serial):
10521033- Let {subsequentResults} be the corresponding entry on {incrementalPublisher}.
10531034- Return {initialResult} and {subsequentResults}.
10541035
1055- AddNewDeferFragments(incrementalPublisher, newDeferUsages,
1056- incrementalDataRecord, deferMap, path):
1036+ AddNewDeferFragments(incrementalPublisher, newDeferUsages, incrementalDataId,
1037+ deferMap, path):
10571038
10581039- Initialize {newDeferredGroupedFieldSets} to an empty list.
10591040- If {newDeferUsages} is empty:
@@ -1065,36 +1046,33 @@ incrementalDataRecord, deferMap, path):
10651046 - Set the entry for {deferUsage} in {newDeferMap} to {deferredFragment}.
10661047- Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
10671048- For each {deferUsage} in {newDeferUsages}:
1049+ - Let {id} be a unique identifier for this execution.
10681050 - Let {label} be the corresponding entry on {deferUsage}.
1069- - Let {parent} be (GetParent(deferUsage, deferMap, incrementalDataRecord )).
1051+ - Let {parent} be (GetParent(deferUsage, deferMap, incrementalDataId )).
10701052 - Let {parentId} be the entry for {id} on {parent}.
1071- - Let {deferredFragment} be a new Deferred Fragment Record.
1072- - Let {id} be the corresponding entry on {deferredFragment}.
1073- - Enqueue a New Deferred Fragment Event on {eventQueue} with details {label},
1074- {path}, and {parentId}.
1075- - Set the entry for {deferUsage} in {newDeferMap} to {deferredFragment}.
1053+ - Enqueue a New Deferred Fragment Event on {eventQueue} with details {id},
1054+ {label}, {path}, and {parentId}.
1055+ - Set the entry for {deferUsage} in {newDeferMap} to {id}.
10761056 - Return {newDeferMap}.
10771057
1078- GetParent(deferUsage, deferMap, incrementalDataRecord ):
1058+ GetParent(deferUsage, deferMap, incrementalDataId ):
10791059
10801060- Let {ancestors} be the corresponding entry on {deferUsage}.
10811061- Let {parentDeferUsage} be the first member of {ancestors}.
1082- - If {parentDeferUsage} is not defined, return {incrementalDataRecord }.
1062+ - If {parentDeferUsage} is not defined, return {incrementalDataId }.
10831063- Let {parent} be the corresponding entry in {deferMap} for {parentDeferUsage}.
10841064- Return {parent}.
10851065
10861066AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap, deferMap,
10871067path):
10881068
10891069- Initialize {detailsList} to an empty list.
1090- - For each {deferUsageSet} and {details } in {groupDetailsMap}:
1070+ - For each {deferUsageSet} and {groupDetails } in {groupDetailsMap}:
10911071 - Let {groupedFieldSet} and {shouldInitiateDefer} be the corresponding entries
1092- on {details}.
1093- - Let {deferredGroupedFieldSetRecord} be a new Deferred Grouped Field Set
1094- Record.
1095- - Initialize {recordDetails} to an empty unordered map.
1096- - Set the corresponding entries on {recordDetails} to
1097- {deferredGroupedFieldSetRecord}, {groupedFieldSet}, and
1072+ on {groupDetails}.
1073+ - Let {id} be an identifier unique to this execution.
1074+ - Initialize {details} to an empty unordered map.
1075+ - Set the corresponding entries on {details} to {id}, {groupedFieldSet}, and
10981076 {shouldInitiateDefer}.
10991077 - Let {deferredFragments} be the result of
11001078 {GetDeferredFragments(deferUsageSet, newDeferMap)}.
@@ -1106,7 +1084,7 @@ path):
11061084 - Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
11071085 - Enqueue a New Deferred Grouped Field Set Event on {eventQueue} with details
11081086 {id}, {path}, and {fragmentIds}.
1109- - Append {recordDetails } to {detailsList}.
1087+ - Append {details } to {detailsList}.
11101088- Return {detailsList}.
11111089
11121090GetDeferredFragments(deferUsageSet, deferMap):
@@ -1124,7 +1102,7 @@ type need to be known, as well as whether it must be executed serially, or may
11241102be executed in parallel.
11251103
11261104ExecuteGroupedFieldSet(groupedFieldSet, objectType, objectValue, variableValues,
1127- path, deferMap, incrementalPublisher, incrementalDataRecord ):
1105+ path, deferMap, incrementalPublisher, incrementalDataId ):
11281106
11291107- If {path} is not provided, initialize it to an empty list.
11301108- Initialize {resultMap} to an empty ordered map.
@@ -1138,7 +1116,7 @@ path, deferMap, incrementalPublisher, incrementalDataRecord):
11381116 - If {fieldType} is defined:
11391117 - Let {responseValue} be {ExecuteField(objectType, objectValue, fieldType,
11401118 fieldGroup, variableValues, path, incrementalPublisher,
1141- incrementalDataRecord )}.
1119+ incrementalDataId )}.
11421120 - Set {responseValue} as the value for {responseKey} in {resultMap}.
11431121- Return {resultMap}.
11441122
@@ -1564,9 +1542,10 @@ BuildGroupedFieldSets(fieldsByTarget, targetsByKey, parentTargets)
15641542 - Append {fieldDetails} to the {fields} entry on {fieldGroup}.
15651543 - Let {shouldInitiateDefer} be the corresponding entry on {targetSetDetails}.
15661544 - Initialize {details} to an empty unordered map.
1567- - Set the entry for {groupedFieldSet} in {details} to {newGroupedFieldSet}.
1568- - Set the corresponding entry in {details} to {shouldInitiateDefer}.
1569- - Set the entry for {maskingTargets} in {groupDetailsMap} to {details}.
1545+ - Set the entry for {groupedFieldSet} in {groupDetails} to
1546+ {newGroupedFieldSet}.
1547+ - Set the corresponding entry in {groupDetails} to {shouldInitiateDefer}.
1548+ - Set the entry for {maskingTargets} in {groupDetailsMap} to {groupDetails}.
15701549- Return {groupedFieldSet} and {groupDetailsMap}.
15711550
15721551Note: entries are always added to Grouped Field Set records in the order in
@@ -1633,17 +1612,16 @@ IsSameSet(setA, setB):
16331612ExecuteDeferredGroupedFieldSets(objectType, objectValue, variableValues,
16341613incrementalPublisher, path, detailsList, deferMap)
16351614
1636- - For each {recordDetails } in {detailsList}, allowing for parallelization:
1637- - Let {deferredGroupedFieldSetRecord }, {groupedFieldSet}, and
1638- {shouldInitiateDefer} be the corresponding entries on {recordDetails }.
1615+ - For each {details } in {detailsList}, allowing for parallelization:
1616+ - Let {id }, {groupedFieldSet}, and {shouldInitiateDefer} be the corresponding
1617+ entries on {details }.
16391618 - If {shouldInitiateDefer} is {true}:
16401619 - Initiate implementation specific deferral of further execution, resuming
16411620 execution as defined.
16421621 - Let {data} be the result of calling {ExecuteGroupedFieldSet(groupedFieldSet,
16431622 objectType, objectValue, variableValues, path, deferMap,
16441623 incrementalPublisher, deferredGroupedFieldSet)}.
16451624 - Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
1646- - Let {id} be the corresponding entry on {deferredGroupedFieldSetRecord}.
16471625 - If _ field error_ were raised, causing a {null} to be propagated to {data}:
16481626 - Let {incrementalErrors} be the list of such field errors.
16491627 - Enqueue an Errored Deferred Grouped Field Set event with details {id} and
@@ -1663,7 +1641,7 @@ finally completes that value either by recursively executing another selection
16631641set or coercing a scalar value.
16641642
16651643ExecuteField(objectType, objectValue, fieldType, fieldGroup, variableValues,
1666- path, deferMap, incrementalPublisher, incrementalDataRecord ):
1644+ path, deferMap, incrementalPublisher, incrementalDataId ):
16671645
16681646- Let {fieldDetails} be the first entry in {fieldGroup}.
16691647- Let {node} be the corresponding entry on {fieldDetails}.
@@ -1674,7 +1652,7 @@ path, deferMap, incrementalPublisher, incrementalDataRecord):
16741652- Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName,
16751653 argumentValues)}.
16761654- Return the result of {CompleteValue(fieldType, fields, resolvedValue,
1677- variableValues, path, deferMap, incrementalPublisher, incrementalDataRecord )}.
1655+ variableValues, path, deferMap, incrementalPublisher, incrementalDataId )}.
16781656
16791657### Coercing Field Arguments
16801658
@@ -1788,8 +1766,7 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
17881766- Let {streamFieldGroup} be the result of {GetStreamFieldGroup(fieldGroup)}.
17891767- Repeat the following steps:
17901768 - Let {itemPath} be {path} with {currentIndex} appended.
1791- - Let {streamItems} be a new Stream Items Record.
1792- - Let {id} be the corresponding entry on {streamItems}.
1769+ - Let {id} be an identifier unique to this execution.
17931770 - Let {parentIds} be an empty list.
17941771 - If {currentParent} is a Deferred Grouped Field Set Record.
17951772 - Let {deferredFragments} be the corresponding entry on {currentParent}.
@@ -1812,7 +1789,6 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
18121789 and {incrementalErrors}.
18131790 - Return.
18141791 - If an item is not retrieved because {iterator} has completed:
1815- - Let {id} be the corresponding entry on {streamItems}
18161792 - Enqueue a Completed Empty Stream Items Event on {eventQueue} with details
18171793 {id}.
18181794 - Return.
@@ -1825,22 +1801,20 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
18251801 {innerType} is a Non-Nullable type, let {incrementalErrors} be the list of
18261802 those errors:
18271803 - Set {errored} to {true}.
1828- - Let {id} be the corresponding entry on {streamItems}
18291804 - Enqueue an Errored Stream Items Event on {eventQueue} with details {id}
18301805 and {incrementalErrors}.
18311806 - Return.
18321807 - Let {errors} be the list of all _ field error_ raised while completing this
18331808 item.
18341809 - Initialize {items} to an list containing the single item {data}.
1835- - Let {id} be the corresponding entry on {streamItems}
18361810 - Enqueue a Completed Stream Items Event on {eventQueue} with details {id},
18371811 {items}, and {errors}.
18381812 - Increment {currentIndex}.
18391813 - Set {currentParent} to {streamItems}.
18401814 - Increment {index}.
18411815
18421816CompleteValue(fieldType, fieldGroup, result, variableValues, path, deferMap,
1843- incrementalPublisher, incrementalDataRecord ):
1817+ incrementalPublisher, incrementalDataId ):
18441818
18451819- If the {fieldType} is a Non-Null type:
18461820 - Let {innerType} be the inner type of {fieldType}.
@@ -1872,15 +1846,13 @@ incrementalPublisher, incrementalDataRecord):
18721846 - While {result} is not closed:
18731847 - If {streamDirective} is defined and {index} is greater than or equal to
18741848 {initialCount}:
1875- - Let {stream} be a new Stream Record.
1876- - Let {id} be the corresponding entry on {stream}.
1849+ - Let {id} be an identifier unique to this execution.
18771850 - Let {earlyReturn} be the implementation-specific value denoting how to
18781851 notify {iterator} that no additional items will be requested.
18791852 - Enqueue a New Stream Event on {eventQueue} with details {id}, {label},
18801853 {path}, and {earlyReturn}.
18811854 - Call {ExecuteStreamField(stream, path, iterator, fieldGroup, index,
1882- innerType, variableValues, incrementalPublisher,
1883- incrementalDataRecord)}.
1855+ innerType, variableValues, incrementalPublisher, incrementalDataId)}.
18841856 - Return {items}.
18851857 - Otherwise:
18861858 - Wait for the next item from {result} via the {iterator}.
@@ -1889,7 +1861,7 @@ incrementalPublisher, incrementalDataRecord):
18891861 - Let {itemPath} be {path} with {index} appended.
18901862 - Let {resolvedItem} be the result of calling {CompleteValue(innerType,
18911863 fields, resultItem, variableValues, itemPath, deferMap,
1892- incrementalPublisher, incrementalDataRecord )}.
1864+ incrementalPublisher, incrementalDataId )}.
18931865 - Append {resolvedItem} to {items}.
18941866 - Increment {index}.
18951867 - Return {items}.
@@ -1904,13 +1876,13 @@ incrementalPublisher, incrementalDataRecord):
19041876 {ProcessSubSelectionSets(objectType, fieldGroup, variableValues)}.
19051877 - Let {newDeferMap} be the result of
19061878 {AddNewDeferFragments(incrementalPublisher, newDeferUsages,
1907- incrementalDataRecord , deferMap, path)}.
1879+ incrementalDataId , deferMap, path)}.
19081880 - Let {detailsList} be the result of
19091881 {AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
19101882 newDeferMap, path)}.
19111883 - Let {completed} be the result of evaluating
19121884 {ExecuteGroupedFieldSet(groupedFieldSet, objectType, result, variableValues,
1913- path, newDeferMap, incrementalPublisher, incrementalDataRecord )} _ normally_
1885+ path, newDeferMap, incrementalPublisher, incrementalDataId )} _ normally_
19141886 (allowing for parallelization).
19151887 - In parallel, call {ExecuteDeferredGroupedFieldSets(objectType, result,
19161888 variableValues, incrementalPublisher, detailsList, newDeferMap)}.
0 commit comments