rethinkdb 1.2.6.1 → 1.4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/exc.rb +30 -0
- data/lib/func.rb +156 -0
- data/lib/net.rb +137 -177
- data/lib/ql2.pb.rb +615 -0
- data/lib/rethinkdb.rb +70 -9
- data/lib/rpp.rb +191 -0
- data/lib/shim.rb +101 -0
- metadata +13 -21
- data/lib/base_classes.rb +0 -39
- data/lib/bt.rb +0 -148
- data/lib/data_collectors.rb +0 -35
- data/lib/jsons.rb +0 -140
- data/lib/protob_compiler.rb +0 -137
- data/lib/query.rb +0 -111
- data/lib/query_language.pb.rb +0 -687
- data/lib/rql.rb +0 -472
- data/lib/sequence.rb +0 -350
- data/lib/streams.rb +0 -101
- data/lib/tables.rb +0 -123
- data/lib/utils.rb +0 -118
- data/lib/writes.rb +0 -24
data/lib/ql2.pb.rb
ADDED
@@ -0,0 +1,615 @@
|
|
1
|
+
### Generated by rprotoc. DO NOT EDIT!
|
2
|
+
### <proto file: ../../src/rdb_protocol/ql2.proto>
|
3
|
+
# ////////////////////////////////////////////////////////////////////////////////
|
4
|
+
# // THE HIGH-LEVEL VIEW //
|
5
|
+
# ////////////////////////////////////////////////////////////////////////////////
|
6
|
+
#
|
7
|
+
# // Process: First send the magic number for the version of the protobuf you're
|
8
|
+
# // targetting (in the [Version] enum). This should **NOT** be sent as a
|
9
|
+
# // protobuf; just send the little-endian 32-bit integer over the wire raw.
|
10
|
+
# // Next, send [Query] protobufs and wait for [Response] protobufs with the same
|
11
|
+
# // token. You can see an example exchange below in **EXAMPLE**.
|
12
|
+
#
|
13
|
+
# // A query consists of a [Term] to evaluate and a unique-per-connection
|
14
|
+
# // [token].
|
15
|
+
#
|
16
|
+
# // Tokens are used for two things:
|
17
|
+
# // * Keeping track of which responses correspond to which queries.
|
18
|
+
# // * Batched queries. Some queries return lots of results, so we send back
|
19
|
+
# // batches of <1000, and you need to send a [CONTINUE] query with the same
|
20
|
+
# // token to get more results from the original query.
|
21
|
+
# ////////////////////////////////////////////////////////////////////////////////
|
22
|
+
#
|
23
|
+
# // This enum contains the magic numbers for your version. See **THE HIGH-LEVEL
|
24
|
+
# // VIEW** for what to do with it.
|
25
|
+
# message VersionDummy { // We need to wrap it like this for some
|
26
|
+
# // non-conforming protobuf libraries
|
27
|
+
# enum Version {
|
28
|
+
# V0_1 = 0x3f61ba36;
|
29
|
+
# };
|
30
|
+
# };
|
31
|
+
#
|
32
|
+
# // You send one of:
|
33
|
+
# // * A [START] query with a [Term] to evaluate and a unique-per-connection token.
|
34
|
+
# // * A [CONTINUE] query with the same token as a [START] query that returned
|
35
|
+
# // [SUCCESS_PARTIAL] in its [Response].
|
36
|
+
# // * A [STOP] query with the same token as a [START] query that you want to stop.
|
37
|
+
# message Query {
|
38
|
+
# enum QueryType {
|
39
|
+
# START = 1; // Start a new query.
|
40
|
+
# CONTINUE = 2; // Continue a query that returned [SUCCESS_PARTIAL]
|
41
|
+
# // (see [Response]).
|
42
|
+
# STOP = 3; // Stop a query partway through executing.
|
43
|
+
# };
|
44
|
+
# optional QueryType type = 1;
|
45
|
+
# // A [Term] is how we represent the operations we want a query to perform.
|
46
|
+
# optional Term query = 2; // only present when [type] = [START]
|
47
|
+
# optional int64 token = 3;
|
48
|
+
# optional bool noreply = 4 [default = false]; // CURRENTLY IGNORED, NO SERVER SUPPORT
|
49
|
+
#
|
50
|
+
# message AssocPair {
|
51
|
+
# optional string key = 1;
|
52
|
+
# optional Term val = 2;
|
53
|
+
# };
|
54
|
+
# repeated AssocPair global_optargs = 6;
|
55
|
+
# };
|
56
|
+
#
|
57
|
+
# // A backtrace frame (see `backtrace` in Response below)
|
58
|
+
# message Frame {
|
59
|
+
# enum FrameType {
|
60
|
+
# POS = 1; // Error occured in a positional argument.
|
61
|
+
# OPT = 2; // Error occured in an optional argument.
|
62
|
+
# };
|
63
|
+
# optional FrameType type = 1;
|
64
|
+
# optional int64 pos = 2; // The index of the positional argument.
|
65
|
+
# optional string opt = 3; // The name of the optional argument.
|
66
|
+
# };
|
67
|
+
# message Backtrace {
|
68
|
+
# repeated Frame frames = 1;
|
69
|
+
# }
|
70
|
+
#
|
71
|
+
# // You get back a response with the same [token] as your query.
|
72
|
+
# message Response {
|
73
|
+
# enum ResponseType {
|
74
|
+
# // These response types indicate success.
|
75
|
+
# SUCCESS_ATOM = 1; // Query returned a single RQL datatype.
|
76
|
+
# SUCCESS_SEQUENCE = 2; // Query returned a sequence of RQL datatypes.
|
77
|
+
# SUCCESS_PARTIAL = 3; // Query returned a partial sequence of RQL
|
78
|
+
# // datatypes. If you send a [CONTINUE] query with
|
79
|
+
# // the same token as this response, you will get
|
80
|
+
# // more of the sequence. Keep sending [CONTINUE]
|
81
|
+
# // queries until you get back [SUCCESS_SEQUENCE].
|
82
|
+
#
|
83
|
+
# // These response types indicate failure.
|
84
|
+
# CLIENT_ERROR = 16; // Means the client is buggy. An example is if the
|
85
|
+
# // client sends a malformed protobuf, or tries to
|
86
|
+
# // send [CONTINUE] for an unknown token.
|
87
|
+
# COMPILE_ERROR = 17; // Means the query failed during parsing or type
|
88
|
+
# // checking. For example, if you pass too many
|
89
|
+
# // arguments to a function.
|
90
|
+
# RUNTIME_ERROR = 18; // Means the query failed at runtime. An example is
|
91
|
+
# // if you add together two values from a table, but
|
92
|
+
# // they turn out at runtime to be booleans rather
|
93
|
+
# // than numbers.
|
94
|
+
# };
|
95
|
+
# optional ResponseType type = 1;
|
96
|
+
# optional int64 token = 2; // Indicates what [Query] this response corresponds to.
|
97
|
+
#
|
98
|
+
# // [response] contains 1 RQL datum if [type] is [SUCCESS_ATOM], or many RQL
|
99
|
+
# // data if [type] is [SUCCESS_SEQUENCE] or [SUCCESS_PARTIAL]. It contains 1
|
100
|
+
# // error message (of type [R_STR]) in all other cases.
|
101
|
+
# repeated Datum response = 3;
|
102
|
+
#
|
103
|
+
# // If [type] is [CLIENT_ERROR], [TYPE_ERROR], or [RUNTIME_ERROR], then a
|
104
|
+
# // backtrace will be provided. The backtrace says where in the query the
|
105
|
+
# // error occured. Ideally this information will be presented to the user as
|
106
|
+
# // a pretty-printed version of their query with the erroneous section
|
107
|
+
# // underlined. A backtrace is a series of 0 or more [Frame]s, each of which
|
108
|
+
# // specifies either the index of a positional argument or the name of an
|
109
|
+
# // optional argument. (Those words will make more sense if you look at the
|
110
|
+
# // [Term] message below.)
|
111
|
+
#
|
112
|
+
# optional Backtrace backtrace = 4; // Contains n [Frame]s when you get back an error.
|
113
|
+
# };
|
114
|
+
#
|
115
|
+
# // A [Datum] is a chunk of data that can be serialized to disk or returned to
|
116
|
+
# // the user in a Response. Currently we only support JSON types, but we may
|
117
|
+
# // support other types in the future (e.g., a date type or an integer type).
|
118
|
+
# message Datum {
|
119
|
+
# enum DatumType {
|
120
|
+
# R_NULL = 1;
|
121
|
+
# R_BOOL = 2;
|
122
|
+
# R_NUM = 3; // a double
|
123
|
+
# R_STR = 4;
|
124
|
+
# R_ARRAY = 5;
|
125
|
+
# R_OBJECT = 6;
|
126
|
+
# };
|
127
|
+
# optional DatumType type = 1;
|
128
|
+
# optional bool r_bool = 2;
|
129
|
+
# optional double r_num = 3;
|
130
|
+
# optional string r_str = 4;
|
131
|
+
#
|
132
|
+
# repeated Datum r_array = 5;
|
133
|
+
# message AssocPair {
|
134
|
+
# optional string key = 1;
|
135
|
+
# optional Datum val = 2;
|
136
|
+
# };
|
137
|
+
# repeated AssocPair r_object = 6;
|
138
|
+
#
|
139
|
+
# extensions 10000 to 20000;
|
140
|
+
# };
|
141
|
+
#
|
142
|
+
# // A [Term] is either a piece of data (see **Datum** above), or an operator and
|
143
|
+
# // its operands. If you have a [Datum], it's stored in the member [datum]. If
|
144
|
+
# // you have an operator, its positional arguments are stored in [args] and its
|
145
|
+
# // optional arguments are stored in [optargs].
|
146
|
+
# //
|
147
|
+
# // A note about type signatures:
|
148
|
+
# // We use the following notation to denote types:
|
149
|
+
# // arg1_type, arg2_type, argrest_type... -> result_type
|
150
|
+
# // So, for example, if we have a function `avg` that takes any number of
|
151
|
+
# // arguments and averages them, we might write:
|
152
|
+
# // NUMBER... -> NUMBER
|
153
|
+
# // Or if we had a function that took one number modulo another:
|
154
|
+
# // NUMBER, NUMBER -> NUMBER
|
155
|
+
# // Or a function that takes a table and a primary key of any Datum type, then
|
156
|
+
# // retrieves the entry with that primary key:
|
157
|
+
# // Table, DATUM -> OBJECT
|
158
|
+
# // Some arguments must be provided as literal values (and not the results of sub
|
159
|
+
# // terms). These are marked with a `!`.
|
160
|
+
# // Optional arguments are specified within curly braces as argname `:` value
|
161
|
+
# // type (e.x `{use_outdated:BOOL}`)
|
162
|
+
# // The RQL type hierarchy is as follows:
|
163
|
+
# // Top
|
164
|
+
# // DATUM
|
165
|
+
# // NULL
|
166
|
+
# // BOOL
|
167
|
+
# // NUMBER
|
168
|
+
# // STRING
|
169
|
+
# // OBJECT
|
170
|
+
# // SingleSelection
|
171
|
+
# // ARRAY
|
172
|
+
# // Sequence
|
173
|
+
# // ARRAY
|
174
|
+
# // Stream
|
175
|
+
# // StreamSelection
|
176
|
+
# // Table
|
177
|
+
# // Database
|
178
|
+
# // Function
|
179
|
+
# // Error
|
180
|
+
# message Term {
|
181
|
+
# enum TermType {
|
182
|
+
# // A RQL datum, stored in `datum` below.
|
183
|
+
# DATUM = 1;
|
184
|
+
#
|
185
|
+
# MAKE_ARRAY = 2; // DATUM... -> ARRAY
|
186
|
+
# // Evaluate the terms in [optargs] and make an object
|
187
|
+
# MAKE_OBJ = 3; // {...} -> OBJECT
|
188
|
+
#
|
189
|
+
# // * Compound types
|
190
|
+
# // Takes an integer representing a variable and returns the value stored
|
191
|
+
# // in that variable. It's the responsibility of the client to translate
|
192
|
+
# // from their local representation of a variable to a unique integer for
|
193
|
+
# // that variable. (We do it this way instead of letting clients provide
|
194
|
+
# // variable names as strings to discourage variable-capturing client
|
195
|
+
# // libraries, and because it's more efficient on the wire.)
|
196
|
+
# VAR = 10; // !NUMBER -> DATUM
|
197
|
+
# // Takes some javascript code and executes it.
|
198
|
+
# JAVASCRIPT = 11; // STRING -> DATUM | STRING -> Function(*)
|
199
|
+
# // Takes a string and throws an error with that message.
|
200
|
+
# ERROR = 12; // STRING -> Error
|
201
|
+
# // Takes nothing and returns a reference to the implicit variable.
|
202
|
+
# IMPLICIT_VAR = 13; // -> DATUM
|
203
|
+
#
|
204
|
+
# // * Data Operators
|
205
|
+
# // Returns a reference to a database.
|
206
|
+
# DB = 14; // STRING -> Database
|
207
|
+
# // Returns a reference to a table.
|
208
|
+
# TABLE = 15; // Database, STRING, {use_outdated:BOOL} -> Table | STRING, {use_outdated:BOOL} -> Table
|
209
|
+
# // Gets a single element from a table by its primary key.
|
210
|
+
# GET = 16; // Table, STRING -> SingleSelection | Table, NUMBER -> SingleSelection |
|
211
|
+
# // Table, STRING -> NULL | Table, NUMBER -> NULL
|
212
|
+
#
|
213
|
+
# // Simple DATUM Ops
|
214
|
+
# EQ = 17; // DATUM... -> BOOL
|
215
|
+
# NE = 18; // DATUM... -> BOOL
|
216
|
+
# LT = 19; // DATUM... -> BOOL
|
217
|
+
# LE = 20; // DATUM... -> BOOL
|
218
|
+
# GT = 21; // DATUM... -> BOOL
|
219
|
+
# GE = 22; // DATUM... -> BOOL
|
220
|
+
# NOT = 23; // BOOL -> BOOL
|
221
|
+
# // ADD can either add two numbers or concatenate two arrays.
|
222
|
+
# ADD = 24; // NUMBER... -> NUMBER | STRING... -> STRING
|
223
|
+
# SUB = 25; // NUMBER... -> NUMBER
|
224
|
+
# MUL = 26; // NUMBER... -> NUMBER
|
225
|
+
# DIV = 27; // NUMBER... -> NUMBER
|
226
|
+
# MOD = 28; // NUMBER, NUMBER -> NUMBER
|
227
|
+
#
|
228
|
+
# // DATUM Array Ops
|
229
|
+
# // Append a single element to the end of an array (like `snoc`).
|
230
|
+
# APPEND = 29; // ARRAY, DATUM -> ARRAY
|
231
|
+
# SLICE = 30; // Sequence, NUMBER, NUMBER -> Sequence
|
232
|
+
# SKIP = 70; // Sequence, NUMBER -> Sequence
|
233
|
+
# LIMIT = 71; // Sequence, NUMBER -> Sequence
|
234
|
+
#
|
235
|
+
# // Stream/Object Ops
|
236
|
+
# // Get a particular attribute out of an object, or map that over a
|
237
|
+
# // sequence.
|
238
|
+
# GETATTR = 31; // OBJECT, STRING -> DATUM
|
239
|
+
# // Check whether an object contains all of a set of attributes, or map
|
240
|
+
# // that over a sequence.
|
241
|
+
# CONTAINS = 32; // OBJECT, STRING... -> BOOL
|
242
|
+
# // Get a subset of an object by selecting some attributes to preserve,
|
243
|
+
# // or map that over a sequence. (Both pick and pluck, polymorphic.)
|
244
|
+
# PLUCK = 33; // Sequence, STRING... -> Sequence | OBJECT, STRING... -> OBJECT
|
245
|
+
# // Get a subset of an object by selecting some attributes to discard, or
|
246
|
+
# // map that over a sequence. (Both unpick and without, polymorphic.)
|
247
|
+
# WITHOUT = 34; // Sequence, STRING... -> Sequence | OBJECT, STRING... -> OBJECT
|
248
|
+
# // Merge objects (right-preferential)
|
249
|
+
# MERGE = 35; // OBJECT... -> OBJECT | Sequence -> Sequence
|
250
|
+
#
|
251
|
+
# // Sequence Ops
|
252
|
+
# // Get all elements of a sequence between two values.
|
253
|
+
# BETWEEN = 36; // StreamSelection, {left_bound:DATUM, right_bound:DATUM} -> StreamSelection
|
254
|
+
# REDUCE = 37; // Sequence, Function(2), {base:DATUM} -> DATUM
|
255
|
+
# MAP = 38; // Sequence, Function(1) -> Sequence
|
256
|
+
# FILTER = 39; // Sequence, Function(1) -> Sequence | Sequence, OBJECT -> Sequence
|
257
|
+
# // Map a function over a sequence and then concatenate the results together.
|
258
|
+
# CONCATMAP = 40; // Sequence, Function(1) -> Sequence
|
259
|
+
# // Order a sequence based on one or more attributes.
|
260
|
+
# ORDERBY = 41; // Sequence, !STRING... -> Sequence
|
261
|
+
# // Get all distinct elements of a sequence (like `uniq`).
|
262
|
+
# DISTINCT = 42; // Sequence -> Sequence
|
263
|
+
# // Count the number of elements in a sequence.
|
264
|
+
# COUNT = 43; // Sequence -> NUMBER
|
265
|
+
# // Take the union of multiple sequences (preserves duplicate elements! (use distinct)).
|
266
|
+
# UNION = 44; // Sequence... -> Sequence
|
267
|
+
# // Get the Nth element of a sequence.
|
268
|
+
# NTH = 45; // Sequence, NUMBER -> DATUM
|
269
|
+
# // Takes a sequence, and three functions:
|
270
|
+
# // - A function to group the sequence by.
|
271
|
+
# // - A function to map over the groups.
|
272
|
+
# // - A reduction to apply to each of the groups.
|
273
|
+
# GROUPED_MAP_REDUCE = 46; // Sequence, Function(1), Function(1), Function(2), {base:DATUM} -> Sequence
|
274
|
+
# // Groups a sequence by one or more attributes, and then applies a reduction.
|
275
|
+
# GROUPBY = 47; // Sequence, ARRAY, !OBJECT -> Sequence
|
276
|
+
# INNER_JOIN = 48; // Sequence, Sequence, Function(2) -> Sequence
|
277
|
+
# OUTER_JOIN = 49; // Sequence, Sequence, Function(2) -> Sequence
|
278
|
+
# // An inner-join that does an equality comparison on two attributes.
|
279
|
+
# EQ_JOIN = 50; // Sequence, !STRING, Sequence -> Sequence
|
280
|
+
# ZIP = 72; // Sequence -> Sequence
|
281
|
+
#
|
282
|
+
#
|
283
|
+
# // * Type Ops
|
284
|
+
# // Coerces a datum to a named type (e.g. "bool").
|
285
|
+
# // If you previously used `stream_to_array`, you should use this instead
|
286
|
+
# // with the type "array".
|
287
|
+
# COERCE_TO = 51; // Top, STRING -> Top
|
288
|
+
# // Returns the named type of a datum (e.g. TYPEOF(true) = "BOOL")
|
289
|
+
# TYPEOF = 52; // Top -> STRING
|
290
|
+
#
|
291
|
+
# // * Write Ops (the OBJECTs contain data about number of errors etc.)
|
292
|
+
# // Updates all the rows in a selection. Calls its Function with the row
|
293
|
+
# // to be updated, and then merges the result of that call.
|
294
|
+
# UPDATE = 53; // StreamSelection, Function(1), {non_atomic:BOOL} -> OBJECT |
|
295
|
+
# // SingleSelection, Function(1), {non_atomic:BOOL} -> OBJECT |
|
296
|
+
# // StreamSelection, OBJECT, {non_atomic:BOOL} -> OBJECT |
|
297
|
+
# // SingleSelection, OBJECT, {non_atomic:BOOL} -> OBJECT
|
298
|
+
# // Deletes all the rows in a selection.
|
299
|
+
# DELETE = 54; // StreamSelection -> OBJECT | SingleSelection -> OBJECT
|
300
|
+
# // Replaces all the rows in a selection. Calls its Function with the row
|
301
|
+
# // to be replaced, and then discards it and stores the result of that
|
302
|
+
# // call.
|
303
|
+
# REPLACE = 55; // StreamSelection, Function(1), {non_atomic:BOOL} -> OBJECT | SingleSelection, Function(1), {non_atomic:BOOL} -> OBJECT
|
304
|
+
# // Inserts into a table. If `upsert` is true, overwrites entries with
|
305
|
+
# // the same primary key (otherwise errors).
|
306
|
+
# INSERT = 56; // Table, OBJECT, {upsert:BOOL} -> OBJECT | Table, Sequence, {upsert:BOOL} -> OBJECT
|
307
|
+
#
|
308
|
+
# // * Administrative OPs
|
309
|
+
# // Creates a database with a particular name.
|
310
|
+
# DB_CREATE = 57; // STRING -> OBJECT
|
311
|
+
# // Drops a database with a particular name.
|
312
|
+
# DB_DROP = 58; // STRING -> OBJECT
|
313
|
+
# // Lists all the databases by name. (Takes no arguments)
|
314
|
+
# DB_LIST = 59; // -> ARRAY
|
315
|
+
# // Creates a table with a particular name in a particular database.
|
316
|
+
# TABLE_CREATE = 60; // Database, STRING, {datacenter:STRING, primary_key:STRING, cache_size:NUMBER} -> OBJECT
|
317
|
+
# // Drops a table with a particular name from a particular database.
|
318
|
+
# TABLE_DROP = 61; // Database, STRING -> OBJECT
|
319
|
+
# // Lists all the tables in a particular database.
|
320
|
+
# TABLE_LIST = 62; // Database -> ARRAY
|
321
|
+
#
|
322
|
+
# // * Control Operators
|
323
|
+
# // Calls a function on data
|
324
|
+
# FUNCALL = 64; // Function(*), DATUM... -> DATUM
|
325
|
+
# // Executes its first argument, and returns its second argument if it
|
326
|
+
# // got [true] or its third argument if it got [false] (like an `if`
|
327
|
+
# // statement).
|
328
|
+
# BRANCH = 65; // BOOL, Top, Top -> Top
|
329
|
+
# // Returns true if any of its arguments returns true (short-circuits).
|
330
|
+
# // (Like `or` in most languages.)
|
331
|
+
# ANY = 66; // BOOL... -> BOOL
|
332
|
+
# // Returns true if all of its arguments return true (short-circuits).
|
333
|
+
# // (Like `and` in most languages.)
|
334
|
+
# ALL = 67; // BOOL... -> BOOL
|
335
|
+
# // Calls its Function with each entry in the sequence
|
336
|
+
# // and executes the array of terms that Function returns.
|
337
|
+
# FOREACH = 68; // Sequence, Function(1) -> OBJECT
|
338
|
+
#
|
339
|
+
# ////////////////////////////////////////////////////////////////////////////////
|
340
|
+
# ////////// Special Terms
|
341
|
+
# ////////////////////////////////////////////////////////////////////////////////
|
342
|
+
#
|
343
|
+
# // An anonymous function. Takes an array of numbers representing
|
344
|
+
# // variables (see [VAR] above), and a [Term] to execute with those in
|
345
|
+
# // scope. Returns a function that may be passed an array of arguments,
|
346
|
+
# // then executes the Term with those bound to the variable names. The
|
347
|
+
# // user will never construct this directly. We use it internally for
|
348
|
+
# // things like `map` which take a function. The "arity" of a [Function] is
|
349
|
+
# // the number of arguments it takes.
|
350
|
+
# // For example, here's what `_X_.map{|x| x+2}` turns into:
|
351
|
+
# // Term {
|
352
|
+
# // type = MAP;
|
353
|
+
# // args = [_X_,
|
354
|
+
# // Term {
|
355
|
+
# // type = Function;
|
356
|
+
# // args = [Term {
|
357
|
+
# // type = DATUM;
|
358
|
+
# // datum = Datum {
|
359
|
+
# // type = R_ARRAY;
|
360
|
+
# // r_array = [Datum { type = R_NUM; r_num = 1; }];
|
361
|
+
# // };
|
362
|
+
# // },
|
363
|
+
# // Term {
|
364
|
+
# // type = ADD;
|
365
|
+
# // args = [Term {
|
366
|
+
# // type = VAR;
|
367
|
+
# // args = [Term {
|
368
|
+
# // type = DATUM;
|
369
|
+
# // datum = Datum { type = R_NUM; r_num = 1};
|
370
|
+
# // }];
|
371
|
+
# // },
|
372
|
+
# // Term {
|
373
|
+
# // type = DATUM;
|
374
|
+
# // datum = Datum { type = R_NUM; r_num = 2; };
|
375
|
+
# // }];
|
376
|
+
# // }];
|
377
|
+
# // }];
|
378
|
+
# FUNC = 69; // ARRAY, Top -> ARRAY -> Top
|
379
|
+
#
|
380
|
+
# ASC = 73;
|
381
|
+
# DESC = 74;
|
382
|
+
# };
|
383
|
+
# optional TermType type = 1;
|
384
|
+
#
|
385
|
+
# // This is only used when type is DATUM.
|
386
|
+
# optional Datum datum = 2;
|
387
|
+
#
|
388
|
+
# repeated Term args = 3; // Holds the positional arguments of the query.
|
389
|
+
# message AssocPair {
|
390
|
+
# optional string key = 1;
|
391
|
+
# optional Term val = 2;
|
392
|
+
# };
|
393
|
+
# repeated AssocPair optargs = 4; // Holds the optional arguments of the query.
|
394
|
+
# // (Note that the order of the optional arguments doesn't matter; think of a
|
395
|
+
# // Hash.)
|
396
|
+
#
|
397
|
+
# extensions 10000 to 20000;
|
398
|
+
# };
|
399
|
+
#
|
400
|
+
# ////////////////////////////////////////////////////////////////////////////////
|
401
|
+
# // EXAMPLE //
|
402
|
+
# ////////////////////////////////////////////////////////////////////////////////
|
403
|
+
# // ```ruby
|
404
|
+
# // r.table('tbl', {:use_outdated => true}).insert([{:id => 0}, {:id => 1}])
|
405
|
+
# // ```
|
406
|
+
# // Would turn into:
|
407
|
+
# // Term {
|
408
|
+
# // type = INSERT;
|
409
|
+
# // args = [Term {
|
410
|
+
# // type = TABLE;
|
411
|
+
# // args = [Term {
|
412
|
+
# // type = R_DATUM;
|
413
|
+
# // r_datum = Datum { type = R_STR; r_str = "tbl"; };
|
414
|
+
# // }];
|
415
|
+
# // optargs = [["use_outdated",
|
416
|
+
# // Term {
|
417
|
+
# // type = R_DATUM;
|
418
|
+
# // r_datum = Datum { type = R_BOOL; r_bool = true; };
|
419
|
+
# // }]];
|
420
|
+
# // },
|
421
|
+
# // Term {
|
422
|
+
# // type = R_ARRAY;
|
423
|
+
# // args = [Term {
|
424
|
+
# // type = R_DATUM;
|
425
|
+
# // r_datum = Datum { type = R_OBJECT; r_object = [["id", 0]]; };
|
426
|
+
# // },
|
427
|
+
# // Term {
|
428
|
+
# // type = R_DATUM;
|
429
|
+
# // r_datum = Datum { type = R_OBJECT; r_object = [["id", 1]]; };
|
430
|
+
# // }];
|
431
|
+
# // }]
|
432
|
+
# // }
|
433
|
+
# // And the server would reply:
|
434
|
+
# // Response {
|
435
|
+
# // type = SUCCESS_ATOM;
|
436
|
+
# // token = 1;
|
437
|
+
# // response = [Datum { type = R_OBJECT; r_object = [["inserted", 2]]; }];
|
438
|
+
# // }
|
439
|
+
# // Or, if there were an error:
|
440
|
+
# // Response {
|
441
|
+
# // type = RUNTIME_ERROR;
|
442
|
+
# // token = 1;
|
443
|
+
# // response = [Datum { type = R_STR; r_str = "The table `tbl` doesn't exist!"; }];
|
444
|
+
# // backtrace = [Frame { type = POS; pos = 0; }, Frame { type = POS; pos = 0; }];
|
445
|
+
# // }
|
446
|
+
|
447
|
+
require 'protobuf/message/message'
|
448
|
+
require 'protobuf/message/enum'
|
449
|
+
require 'protobuf/message/service'
|
450
|
+
require 'protobuf/message/extend'
|
451
|
+
|
452
|
+
class VersionDummy < ::Protobuf::Message
|
453
|
+
defined_in __FILE__
|
454
|
+
class Version < ::Protobuf::Enum
|
455
|
+
defined_in __FILE__
|
456
|
+
V0_1 = value(:V0_1, 1063369270)
|
457
|
+
end
|
458
|
+
end
|
459
|
+
class Query < ::Protobuf::Message
|
460
|
+
defined_in __FILE__
|
461
|
+
class QueryType < ::Protobuf::Enum
|
462
|
+
defined_in __FILE__
|
463
|
+
START = value(:START, 1)
|
464
|
+
CONTINUE = value(:CONTINUE, 2)
|
465
|
+
STOP = value(:STOP, 3)
|
466
|
+
end
|
467
|
+
optional :QueryType, :type, 1
|
468
|
+
optional :Term, :query, 2
|
469
|
+
optional :int64, :token, 3
|
470
|
+
optional :bool, :noreply, 4, :default => false
|
471
|
+
class AssocPair < ::Protobuf::Message
|
472
|
+
defined_in __FILE__
|
473
|
+
optional :string, :key, 1
|
474
|
+
optional :Term, :val, 2
|
475
|
+
end
|
476
|
+
repeated :AssocPair, :global_optargs, 6
|
477
|
+
end
|
478
|
+
class Frame < ::Protobuf::Message
|
479
|
+
defined_in __FILE__
|
480
|
+
class FrameType < ::Protobuf::Enum
|
481
|
+
defined_in __FILE__
|
482
|
+
POS = value(:POS, 1)
|
483
|
+
OPT = value(:OPT, 2)
|
484
|
+
end
|
485
|
+
optional :FrameType, :type, 1
|
486
|
+
optional :int64, :pos, 2
|
487
|
+
optional :string, :opt, 3
|
488
|
+
end
|
489
|
+
class Backtrace < ::Protobuf::Message
|
490
|
+
defined_in __FILE__
|
491
|
+
repeated :Frame, :frames, 1
|
492
|
+
end
|
493
|
+
class Response < ::Protobuf::Message
|
494
|
+
defined_in __FILE__
|
495
|
+
class ResponseType < ::Protobuf::Enum
|
496
|
+
defined_in __FILE__
|
497
|
+
SUCCESS_ATOM = value(:SUCCESS_ATOM, 1)
|
498
|
+
SUCCESS_SEQUENCE = value(:SUCCESS_SEQUENCE, 2)
|
499
|
+
SUCCESS_PARTIAL = value(:SUCCESS_PARTIAL, 3)
|
500
|
+
CLIENT_ERROR = value(:CLIENT_ERROR, 16)
|
501
|
+
COMPILE_ERROR = value(:COMPILE_ERROR, 17)
|
502
|
+
RUNTIME_ERROR = value(:RUNTIME_ERROR, 18)
|
503
|
+
end
|
504
|
+
optional :ResponseType, :type, 1
|
505
|
+
optional :int64, :token, 2
|
506
|
+
repeated :Datum, :response, 3
|
507
|
+
optional :Backtrace, :backtrace, 4
|
508
|
+
end
|
509
|
+
class Datum < ::Protobuf::Message
|
510
|
+
defined_in __FILE__
|
511
|
+
class DatumType < ::Protobuf::Enum
|
512
|
+
defined_in __FILE__
|
513
|
+
R_NULL = value(:R_NULL, 1)
|
514
|
+
R_BOOL = value(:R_BOOL, 2)
|
515
|
+
R_NUM = value(:R_NUM, 3)
|
516
|
+
R_STR = value(:R_STR, 4)
|
517
|
+
R_ARRAY = value(:R_ARRAY, 5)
|
518
|
+
R_OBJECT = value(:R_OBJECT, 6)
|
519
|
+
end
|
520
|
+
optional :DatumType, :type, 1
|
521
|
+
optional :bool, :r_bool, 2
|
522
|
+
optional :double, :r_num, 3
|
523
|
+
optional :string, :r_str, 4
|
524
|
+
repeated :Datum, :r_array, 5
|
525
|
+
class AssocPair < ::Protobuf::Message
|
526
|
+
defined_in __FILE__
|
527
|
+
optional :string, :key, 1
|
528
|
+
optional :Datum, :val, 2
|
529
|
+
end
|
530
|
+
repeated :AssocPair, :r_object, 6
|
531
|
+
extensions 10000..20000
|
532
|
+
end
|
533
|
+
class Term < ::Protobuf::Message
|
534
|
+
defined_in __FILE__
|
535
|
+
class TermType < ::Protobuf::Enum
|
536
|
+
defined_in __FILE__
|
537
|
+
DATUM = value(:DATUM, 1)
|
538
|
+
MAKE_ARRAY = value(:MAKE_ARRAY, 2)
|
539
|
+
MAKE_OBJ = value(:MAKE_OBJ, 3)
|
540
|
+
VAR = value(:VAR, 10)
|
541
|
+
JAVASCRIPT = value(:JAVASCRIPT, 11)
|
542
|
+
ERROR = value(:ERROR, 12)
|
543
|
+
IMPLICIT_VAR = value(:IMPLICIT_VAR, 13)
|
544
|
+
DB = value(:DB, 14)
|
545
|
+
TABLE = value(:TABLE, 15)
|
546
|
+
GET = value(:GET, 16)
|
547
|
+
EQ = value(:EQ, 17)
|
548
|
+
NE = value(:NE, 18)
|
549
|
+
LT = value(:LT, 19)
|
550
|
+
LE = value(:LE, 20)
|
551
|
+
GT = value(:GT, 21)
|
552
|
+
GE = value(:GE, 22)
|
553
|
+
NOT = value(:NOT, 23)
|
554
|
+
ADD = value(:ADD, 24)
|
555
|
+
SUB = value(:SUB, 25)
|
556
|
+
MUL = value(:MUL, 26)
|
557
|
+
DIV = value(:DIV, 27)
|
558
|
+
MOD = value(:MOD, 28)
|
559
|
+
APPEND = value(:APPEND, 29)
|
560
|
+
SLICE = value(:SLICE, 30)
|
561
|
+
SKIP = value(:SKIP, 70)
|
562
|
+
LIMIT = value(:LIMIT, 71)
|
563
|
+
GETATTR = value(:GETATTR, 31)
|
564
|
+
CONTAINS = value(:CONTAINS, 32)
|
565
|
+
PLUCK = value(:PLUCK, 33)
|
566
|
+
WITHOUT = value(:WITHOUT, 34)
|
567
|
+
MERGE = value(:MERGE, 35)
|
568
|
+
BETWEEN = value(:BETWEEN, 36)
|
569
|
+
REDUCE = value(:REDUCE, 37)
|
570
|
+
MAP = value(:MAP, 38)
|
571
|
+
FILTER = value(:FILTER, 39)
|
572
|
+
CONCATMAP = value(:CONCATMAP, 40)
|
573
|
+
ORDERBY = value(:ORDERBY, 41)
|
574
|
+
DISTINCT = value(:DISTINCT, 42)
|
575
|
+
COUNT = value(:COUNT, 43)
|
576
|
+
UNION = value(:UNION, 44)
|
577
|
+
NTH = value(:NTH, 45)
|
578
|
+
GROUPED_MAP_REDUCE = value(:GROUPED_MAP_REDUCE, 46)
|
579
|
+
GROUPBY = value(:GROUPBY, 47)
|
580
|
+
INNER_JOIN = value(:INNER_JOIN, 48)
|
581
|
+
OUTER_JOIN = value(:OUTER_JOIN, 49)
|
582
|
+
EQ_JOIN = value(:EQ_JOIN, 50)
|
583
|
+
ZIP = value(:ZIP, 72)
|
584
|
+
COERCE_TO = value(:COERCE_TO, 51)
|
585
|
+
TYPEOF = value(:TYPEOF, 52)
|
586
|
+
UPDATE = value(:UPDATE, 53)
|
587
|
+
DELETE = value(:DELETE, 54)
|
588
|
+
REPLACE = value(:REPLACE, 55)
|
589
|
+
INSERT = value(:INSERT, 56)
|
590
|
+
DB_CREATE = value(:DB_CREATE, 57)
|
591
|
+
DB_DROP = value(:DB_DROP, 58)
|
592
|
+
DB_LIST = value(:DB_LIST, 59)
|
593
|
+
TABLE_CREATE = value(:TABLE_CREATE, 60)
|
594
|
+
TABLE_DROP = value(:TABLE_DROP, 61)
|
595
|
+
TABLE_LIST = value(:TABLE_LIST, 62)
|
596
|
+
FUNCALL = value(:FUNCALL, 64)
|
597
|
+
BRANCH = value(:BRANCH, 65)
|
598
|
+
ANY = value(:ANY, 66)
|
599
|
+
ALL = value(:ALL, 67)
|
600
|
+
FOREACH = value(:FOREACH, 68)
|
601
|
+
FUNC = value(:FUNC, 69)
|
602
|
+
ASC = value(:ASC, 73)
|
603
|
+
DESC = value(:DESC, 74)
|
604
|
+
end
|
605
|
+
optional :TermType, :type, 1
|
606
|
+
optional :Datum, :datum, 2
|
607
|
+
repeated :Term, :args, 3
|
608
|
+
class AssocPair < ::Protobuf::Message
|
609
|
+
defined_in __FILE__
|
610
|
+
optional :string, :key, 1
|
611
|
+
optional :Term, :val, 2
|
612
|
+
end
|
613
|
+
repeated :AssocPair, :optargs, 4
|
614
|
+
extensions 10000..20000
|
615
|
+
end
|