-
Notifications
You must be signed in to change notification settings - Fork 3
/
rgraphql.proto
156 lines (135 loc) · 3.72 KB
/
rgraphql.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
syntax = "proto3";
package rgraphql;
message RGQLQueryFieldDirective {
// Directive name
string name = 1;
// Optional arguments.
repeated FieldArgument args = 2;
}
message RGQLQueryTreeNode {
// Integer ID of the node.
uint32 id = 1;
// Name of the field this node represents.
string field_name = 2;
// Arguments.
repeated FieldArgument args = 3;
// Directives
repeated RGQLQueryFieldDirective directive = 4;
// Children
repeated RGQLQueryTreeNode children = 5;
}
message FieldArgument {
string name = 1;
uint32 variable_id = 2;
}
message ASTVariable {
uint32 id = 1;
RGQLPrimitive value = 2;
}
message RGQLPrimitive {
Kind kind = 1;
int32 int_value = 2;
double float_value = 3;
string string_value = 4;
bool bool_value = 5;
enum Kind {
PRIMITIVE_KIND_NULL = 0;
PRIMITIVE_KIND_INT = 1;
PRIMITIVE_KIND_FLOAT = 2;
PRIMITIVE_KIND_STRING = 3;
PRIMITIVE_KIND_BOOL = 4;
PRIMITIVE_KIND_OBJECT = 5;
// A marker for an empty array.
PRIMITIVE_KIND_ARRAY = 6;
}
}
// Messages
message RGQLClientMessage {
RGQLQueryInit init_query = 1;
RGQLQueryTreeMutation mutate_tree = 2;
RGQLQueryFinish finish_query = 3;
}
message RGQLQueryInit {
// The ID of this query.
uint32 query_id = 1;
// Force serial for this query?
// Note: serial queries execute as soon as the first mutation arrives, and cannot be updated.
bool force_serial = 2;
// Operation type, i.e. query, mutation, etc.
string operation_type = 3;
}
message RGQLQueryTreeMutation {
// The ID of this query.
uint32 query_id = 1;
// All node mutations in this step.
repeated NodeMutation node_mutation = 2;
// Any new variables.
repeated ASTVariable variables = 3;
message NodeMutation {
// ID of the node we are operating on.
uint32 node_id = 1;
// Operation we are taking.
SubtreeOperation operation = 2;
// The new node tree to add, if we are adding a child.
RGQLQueryTreeNode node = 3;
}
enum SubtreeOperation {
// Add a child tree to the subtree.
SUBTREE_ADD_CHILD = 0;
// Delete a tree node and all children.
SUBTREE_DELETE = 1;
}
}
message RGQLQueryFinish {
// The ID of this query.
uint32 query_id = 1;
}
message RGQLServerMessage {
RGQLQueryError query_error = 2;
RGQLValueInit value_init = 4;
RGQLValueBatch value_batch = 5;
RGQLValueFinalize value_finalize = 6;
}
// RGQLValueInit initializes a result value tree.
message RGQLValueInit {
// result_id is the identifier for the result tree.
uint32 result_id = 1;
// query_id is the identifier for the corresponding query.
uint32 query_id = 2;
// cache_strategy is the strategy used for the path cache.
CacheStrategy cache_strategy = 3;
// cache_size is the size of the path cache, if necessary.
uint32 cache_size = 4;
enum CacheStrategy {
CACHE_LRU = 0;
}
}
// RGQLValueFinalize finalizes a result tree.
message RGQLValueFinalize {
uint32 result_id = 1;
}
// Communicating a failure in the input query.
message RGQLQueryError {
uint32 query_id = 1;
uint32 query_node_id = 2;
string error = 3;
}
message RGQLValue {
// The ID of the field in the query tree, if a field.
uint32 query_node_id = 1;
// The 1-based index, if an array element.
uint32 array_index = 2;
// If this is a 0-th index value, this is a pointer to a previous identifier.
// Otherwise, this is an identifier for adding an alias to this path.
uint32 pos_identifier = 3;
// The value, if we have one.
RGQLPrimitive value = 4;
// The error, if we are erroring this field.
string error = 5;
}
message RGQLValueBatch {
// The ID of the result tree this batch is for.
uint32 result_id = 1;
// The batch of RGQLValue values, encoded.
repeated bytes values = 2;
}