Skip to content

Commit

Permalink
Add some slight doco
Browse files Browse the repository at this point in the history
  • Loading branch information
gnawf committed May 6, 2024
1 parent 5a6a908 commit 026cd09
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/src/main/java/graphql/nadel/result/NadelResultTracker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ internal class NadelResultTracker {
DeadEnd,
}

/**
* So… in Nadel the result can change a lot.
*
* This function lets you track where a result node went to in the overall response sent to the user.
*
* I haven't benchmarked this yet, but in theory it should be more performant than say using
* [graphql.nadel.engine.transform.result.json.JsonNodes].
*
* In the past we used to track the [NadelResultPathSegment]s for each [JsonNode] but that was horrible
* performance wise because we created one List for each result node
* i.e. as the result grew, both in depth and result node count, you'd allocate tons of (big) lists.
*
* This implementation keeps track of the _current_ [NadelResultPathSegment]s and returns that if it
* finds the [node] in question.
*/
suspend fun getResultPath(
queryPath: NadelQueryPath,
node: JsonNode,
Expand Down

0 comments on commit 026cd09

Please sign in to comment.