You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 19, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/DESIGN_GENERAL_NOTES.md
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,4 @@
1
-
Protocol
2
-
========
1
+
# Query-Tree Negotiation
3
2
4
3
When we initially connect to the server, we build a snapshot of the tree and send it to the server. Following, every update to the tree gets transmitted to the server as queries are applied to the store.
5
4
@@ -124,3 +123,44 @@ query myQuery($a: Int!) {
124
123
```
125
124
126
125
The server can be given variable values at the same time as query tree additions. However, the server will forget any variables that aren't relevant to the current query. This way the server keeps only the data it needs in memory with minimal messaging overhead and de-duplicated variable values.
126
+
127
+
# Distributing data to queries efficiently
128
+
129
+
Issue: we have a result tree that looks like:
130
+
131
+
```
132
+
0: {
133
+
1: {
134
+
2: "John",
135
+
3: "Doe",
136
+
4: 28
137
+
5: [153, 148, 140, 133]
138
+
}
139
+
}
140
+
```
141
+
142
+
The array in qnode 5 needs to be shared between the queries. We can detect when we have reached a leaf when there are no child query nodes.
143
+
144
+
Here we have the issue. Cursors often extend into the values, past the qnode child leaves. We need to detach the cursors in the queries when reaching a value node.
145
+
146
+
- Cursors will need to build a "path so far" array (unfortunately).
147
+
- This is necessary for caching.
148
+
- Array of tuples, with `[Kind, (ArrayIndex/QueryNodeID), ValueKind]`
149
+
- Examples (note that "value" in these points to location, is not a copy):
0 commit comments