rethinkdb 1.15.0.0 → 1.16.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.
- checksums.yaml +4 -4
- data/lib/func.rb +11 -5
- data/lib/net.rb +84 -71
- data/lib/ql2.pb.rb +12 -4
- data/lib/rethinkdb.rb +7 -10
- data/lib/rpp.rb +2 -9
- data/lib/shim.rb +8 -7
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1794895a9ff42acedd81e8a39670e7ebdbcda21
|
4
|
+
data.tar.gz: 7eb72083c471ad5e32cbbbd02dbc403d897db87c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c089f1c39bbaeaf3b467cd7601db23e7558e38933497fb178e00916d3000281defaf4c05cb28ee7766274c31e8d9b163091e8975028fdde5e75d83e10014313
|
7
|
+
data.tar.gz: e5acd237522ca83acb6f6302cf35359599c9adb6dfcc43a6f43d6684dc012b3e6c8ff8542d73ac73dd4e63774678b4b606e3685657f42211b29d229525d9c983
|
data/lib/func.rb
CHANGED
@@ -25,6 +25,7 @@ module RethinkDB
|
|
25
25
|
:between => 2,
|
26
26
|
:table => -1,
|
27
27
|
:table_create => -1,
|
28
|
+
:reconfigure => 0,
|
28
29
|
:get_all => -1,
|
29
30
|
:eq_join => -1,
|
30
31
|
:javascript => -1,
|
@@ -32,6 +33,7 @@ module RethinkDB
|
|
32
33
|
:slice => -1,
|
33
34
|
:during => -1,
|
34
35
|
:orderby => -1,
|
36
|
+
:order_by => -1,
|
35
37
|
:group => -1,
|
36
38
|
:iso8601 => -1,
|
37
39
|
:index_create => -1,
|
@@ -42,7 +44,11 @@ module RethinkDB
|
|
42
44
|
:distance => -1,
|
43
45
|
:circle => -1,
|
44
46
|
:get_intersecting => -1,
|
45
|
-
:get_nearest => -1
|
47
|
+
:get_nearest => -1,
|
48
|
+
:min => -1,
|
49
|
+
:max => -1,
|
50
|
+
:changes => -1,
|
51
|
+
:wait => 0
|
46
52
|
}
|
47
53
|
@@method_aliases = {
|
48
54
|
:lt => :<,
|
@@ -56,11 +62,11 @@ module RethinkDB
|
|
56
62
|
:mod => :%,
|
57
63
|
:any => [:"|", :or],
|
58
64
|
:all => [:"&", :and],
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
65
|
+
:order_by => :orderby,
|
66
|
+
:concat_map => :concatmap,
|
67
|
+
:for_each => :foreach,
|
62
68
|
:javascript => :js,
|
63
|
-
:
|
69
|
+
:type_of => :typeof
|
64
70
|
}
|
65
71
|
|
66
72
|
termtypes = Term::TermType.constants.map{ |c| c.to_sym }
|
data/lib/net.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'socket'
|
2
2
|
require 'thread'
|
3
3
|
require 'timeout'
|
4
|
+
require 'pp' # This is needed for pretty_inspect
|
4
5
|
|
5
6
|
module RethinkDB
|
6
7
|
module Faux_Abort
|
@@ -13,8 +14,8 @@ module RethinkDB
|
|
13
14
|
def self.set_default_conn c; @@default_conn = c; end
|
14
15
|
def run(c=@@default_conn, opts=nil, &b)
|
15
16
|
unbound_if(@body == RQL)
|
16
|
-
c, opts = @@default_conn, c if opts
|
17
|
-
opts = {} if opts
|
17
|
+
c, opts = @@default_conn, c if !opts && !c.kind_of?(RethinkDB::Connection)
|
18
|
+
opts = {} if !opts
|
18
19
|
opts = {opts => true} if opts.class != Hash
|
19
20
|
if (tf = opts[:time_format])
|
20
21
|
opts[:time_format] = (tf = tf.to_s)
|
@@ -45,17 +46,17 @@ module RethinkDB
|
|
45
46
|
class Cursor
|
46
47
|
include Enumerable
|
47
48
|
def out_of_date # :nodoc:
|
48
|
-
@conn.conn_id != @conn_id
|
49
|
+
@conn.conn_id != @conn_id || !@conn.is_open()
|
49
50
|
end
|
50
51
|
|
51
52
|
def inspect # :nodoc:
|
52
53
|
preview_res = @results[0...10]
|
53
|
-
if
|
54
|
+
if @results.size > 10 || @more
|
54
55
|
preview_res << (dots = "..."; class << dots; def inspect; "..."; end; end; dots)
|
55
56
|
end
|
56
57
|
preview = preview_res.pretty_inspect[0...-1]
|
57
58
|
state = @run ? "(exhausted)" : "(enumerable)"
|
58
|
-
extra = out_of_date ? " (Connection #{@conn.inspect}
|
59
|
+
extra = out_of_date ? " (Connection #{@conn.inspect} is closed.)" : ""
|
59
60
|
"#<RethinkDB::Cursor:#{self.object_id} #{state}#{extra}: #{RPP.pp(@msg)}" +
|
60
61
|
(@run ? "" : "\n#{preview}") + ">"
|
61
62
|
end
|
@@ -73,12 +74,13 @@ module RethinkDB
|
|
73
74
|
end
|
74
75
|
|
75
76
|
def each (&block) # :nodoc:
|
76
|
-
raise RqlRuntimeError, "Can only iterate over
|
77
|
+
raise RqlRuntimeError, "Can only iterate over a cursor once." if @run
|
78
|
+
return self.enum_for(:each) if !block
|
77
79
|
@run = true
|
78
|
-
raise RqlRuntimeError, "Connection has been reset!" if out_of_date
|
79
80
|
while true
|
80
81
|
@results.each(&block)
|
81
82
|
return self if !@more
|
83
|
+
raise RqlRuntimeError, "Connection is closed." if @more && out_of_date
|
82
84
|
res = @conn.wait(@token)
|
83
85
|
@results = Shim.response_to_native(res, @msg, @opts)
|
84
86
|
if res['t'] == Response::ResponseType::SUCCESS_SEQUENCE
|
@@ -92,9 +94,13 @@ module RethinkDB
|
|
92
94
|
def close
|
93
95
|
if @more
|
94
96
|
@more = false
|
97
|
+
@conn.wait(@token) # Ignore the response - TODO: do this asynchronously
|
95
98
|
q = [Query::QueryType::STOP]
|
96
99
|
res = @conn.run_internal(q, @opts, @token)
|
97
|
-
if res['t'] != Response::ResponseType::SUCCESS_SEQUENCE
|
100
|
+
if ((res['t'] != Response::ResponseType::SUCCESS_SEQUENCE &&
|
101
|
+
res['t'] != Response::ResponseType::SUCCESS_FEED &&
|
102
|
+
res['t'] != Response::ResponseType::SUCCESS_ATOM_FEED) ||
|
103
|
+
res['r'] != [])
|
98
104
|
raise RqlRuntimeError, "Server sent malformed STOP response #{PP.pp(res, "")}"
|
99
105
|
end
|
100
106
|
return true
|
@@ -102,7 +108,7 @@ module RethinkDB
|
|
102
108
|
end
|
103
109
|
|
104
110
|
def fetch_batch
|
105
|
-
@conn.
|
111
|
+
@conn.register_query(@token, @opts)
|
106
112
|
@conn.dispatch([Query::QueryType::CONTINUE], @token)
|
107
113
|
end
|
108
114
|
end
|
@@ -134,7 +140,7 @@ module RethinkDB
|
|
134
140
|
@token_cnt = 0
|
135
141
|
@token_cnt_mutex = Mutex.new
|
136
142
|
|
137
|
-
|
143
|
+
self.connect()
|
138
144
|
end
|
139
145
|
attr_reader :host, :port, :default_db, :conn_id
|
140
146
|
|
@@ -142,19 +148,24 @@ module RethinkDB
|
|
142
148
|
@token_cnt_mutex.synchronize{@token_cnt += 1}
|
143
149
|
end
|
144
150
|
|
145
|
-
def
|
146
|
-
|
151
|
+
def register_query(token, opts)
|
152
|
+
if !opts[:noreply]
|
153
|
+
@listener_mutex.synchronize{
|
154
|
+
raise RqlDriverError, "Internal driver error, token already in use." \
|
155
|
+
if @waiters.has_key?(token)
|
156
|
+
@waiters[token] = ConditionVariable.new
|
157
|
+
@opts[token] = opts
|
158
|
+
}
|
159
|
+
end
|
147
160
|
end
|
148
161
|
def run_internal(q, opts, token)
|
149
|
-
|
150
|
-
noreply = opts[:noreply]
|
151
|
-
|
162
|
+
register_query(token, opts)
|
152
163
|
dispatch(q, token)
|
153
|
-
noreply ? nil : wait(token)
|
164
|
+
opts[:noreply] ? nil : wait(token)
|
154
165
|
end
|
155
166
|
def run(msg, opts, &b)
|
156
|
-
reconnect(:noreply_wait => false) if @auto_reconnect && (
|
157
|
-
raise RqlRuntimeError, "
|
167
|
+
reconnect(:noreply_wait => false) if @auto_reconnect && !self.is_open()
|
168
|
+
raise RqlRuntimeError, "Connection is closed." if !self.is_open()
|
158
169
|
|
159
170
|
global_optargs = {}
|
160
171
|
all_opts = @default_opts.merge(opts)
|
@@ -172,7 +183,8 @@ module RethinkDB
|
|
172
183
|
res = run_internal(q, all_opts, token)
|
173
184
|
return res if !res
|
174
185
|
if res['t'] == Response::ResponseType::SUCCESS_PARTIAL ||
|
175
|
-
|
186
|
+
res['t'] == Response::ResponseType::SUCCESS_FEED ||
|
187
|
+
res['t'] == Response::ResponseType::SUCCESS_ATOM_FEED
|
176
188
|
value = Cursor.new(Shim.response_to_native(res, msg, opts),
|
177
189
|
msg, self, opts, token, true)
|
178
190
|
elsif res['t'] == Response::ResponseType::SUCCESS_SEQUENCE
|
@@ -213,15 +225,20 @@ module RethinkDB
|
|
213
225
|
return token
|
214
226
|
end
|
215
227
|
|
216
|
-
def wait
|
228
|
+
def wait(token)
|
217
229
|
begin
|
218
230
|
res = nil
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
res
|
231
|
+
@listener_mutex.synchronize {
|
232
|
+
raise RqlRuntimeError, "Connection is closed." if !@waiters.has_key?(token)
|
233
|
+
res = @data.delete(token)
|
234
|
+
if res == nil
|
235
|
+
@waiters[token].wait(@listener_mutex)
|
236
|
+
res = @data.delete(token)
|
237
|
+
end
|
238
|
+
@waiters.delete(token)
|
223
239
|
}
|
224
|
-
raise RqlRuntimeError, "Connection closed
|
240
|
+
raise RqlRuntimeError, "Connection is closed." if res.nil? && !self.is_open()
|
241
|
+
raise RqlDriverError, "Internal driver error, no response found." if res.nil?
|
225
242
|
return res
|
226
243
|
rescue @abort_module::Abort => e
|
227
244
|
print "\nAborting query and reconnecting...\n"
|
@@ -239,7 +256,7 @@ module RethinkDB
|
|
239
256
|
def inspect
|
240
257
|
db = @default_opts[:db] || RQL.new.db('test')
|
241
258
|
properties = "(#{@host}:#{@port}) (Default DB: #{db.inspect})"
|
242
|
-
state =
|
259
|
+
state = self.is_open() ? "(open)" : "(closed)"
|
243
260
|
"#<RethinkDB::Connection:#{self.object_id} #{properties} #{state}>"
|
244
261
|
end
|
245
262
|
|
@@ -254,44 +271,53 @@ module RethinkDB
|
|
254
271
|
# enumerables on the client.
|
255
272
|
def reconnect(opts={})
|
256
273
|
raise ArgumentError, "Argument to reconnect must be a hash." if opts.class != Hash
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
end
|
261
|
-
opts[:noreply_wait] = true if not opts.keys.include?(:noreply_wait)
|
262
|
-
|
263
|
-
self.noreply_wait() if opts[:noreply_wait]
|
274
|
+
self.close(opts)
|
275
|
+
self.connect()
|
276
|
+
end
|
264
277
|
|
265
|
-
|
266
|
-
|
278
|
+
def connect()
|
279
|
+
raise RuntimeError, "Connection must be closed before calling connect." if @socket
|
267
280
|
@socket = TCPSocket.open(@host, @port)
|
281
|
+
@listener_mutex = Mutex.new
|
268
282
|
@waiters = {}
|
269
283
|
@opts = {}
|
270
284
|
@data = {}
|
271
|
-
@mutex = Mutex.new
|
272
285
|
@conn_id += 1
|
273
286
|
start_listener
|
274
|
-
|
275
287
|
self
|
276
288
|
end
|
277
289
|
|
290
|
+
def is_open()
|
291
|
+
@socket && @listener
|
292
|
+
end
|
293
|
+
|
278
294
|
def close(opts={})
|
279
295
|
raise ArgumentError, "Argument to close must be a hash." if opts.class != Hash
|
280
|
-
if
|
296
|
+
if !(opts.keys - [:noreply_wait]).empty?
|
281
297
|
raise ArgumentError, "close does not understand these options: " +
|
282
298
|
(opts.keys - [:noreply_wait]).to_s
|
283
299
|
end
|
284
|
-
opts[:noreply_wait] = true if
|
300
|
+
opts[:noreply_wait] = true if !opts.keys.include?(:noreply_wait)
|
285
301
|
|
286
|
-
self.noreply_wait() if opts[:noreply_wait]
|
287
|
-
|
302
|
+
self.noreply_wait() if opts[:noreply_wait] && self.is_open()
|
303
|
+
if @listener
|
304
|
+
@listener.terminate
|
305
|
+
@listener.join
|
306
|
+
end
|
307
|
+
@socket.close if @socket
|
288
308
|
@listener = nil
|
289
|
-
@socket.close
|
290
309
|
@socket = nil
|
310
|
+
@listener_mutex.synchronize {
|
311
|
+
@opts.clear
|
312
|
+
@data.clear
|
313
|
+
@waiters.values.each{ |w| w.signal }
|
314
|
+
@waiters.clear
|
315
|
+
}
|
316
|
+
self
|
291
317
|
end
|
292
318
|
|
293
319
|
def noreply_wait
|
294
|
-
raise RqlRuntimeError, "
|
320
|
+
raise RqlRuntimeError, "Connection is closed." if !self.is_open()
|
295
321
|
q = [Query::QueryType::NOREPLY_WAIT]
|
296
322
|
res = run_internal(q, {noreply: false}, new_token)
|
297
323
|
if res['t'] != Response::ResponseType::WAIT_COMPLETE
|
@@ -305,24 +331,18 @@ module RethinkDB
|
|
305
331
|
raise RqlRuntimeError, "No last connection. Use RethinkDB::Connection.new."
|
306
332
|
end
|
307
333
|
|
308
|
-
def stop_listener
|
309
|
-
if @listener
|
310
|
-
@listener.terminate
|
311
|
-
@listener.join
|
312
|
-
@listener = nil
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
334
|
def note_data(token, data) # Synchronize around this!
|
335
|
+
raise RqlDriverError, "Unknown token in response." if !@waiters.has_key?(token)
|
317
336
|
@data[token] = data
|
318
337
|
@opts.delete(token)
|
319
|
-
|
338
|
+
w = @waiters[token]
|
339
|
+
w.signal if w
|
320
340
|
end
|
321
341
|
|
322
342
|
def note_error(token, e) # Synchronize around this!
|
323
343
|
data = {
|
324
|
-
't' =>
|
325
|
-
'r' => [e.
|
344
|
+
't' => Response::ResponseType::CLIENT_ERROR,
|
345
|
+
'r' => [e.message],
|
326
346
|
'b' => []
|
327
347
|
}
|
328
348
|
note_data(token, data)
|
@@ -336,7 +356,7 @@ module RethinkDB
|
|
336
356
|
def read_exn(len, timeout_sec=nil)
|
337
357
|
maybe_timeout(timeout_sec) {
|
338
358
|
buf = read len
|
339
|
-
if !buf
|
359
|
+
if !buf || buf.length != len
|
340
360
|
raise RqlRuntimeError, "Connection closed by server."
|
341
361
|
end
|
342
362
|
return buf
|
@@ -351,14 +371,15 @@ module RethinkDB
|
|
351
371
|
end
|
352
372
|
response = response[0...-1]
|
353
373
|
if response != "SUCCESS"
|
354
|
-
raise RqlRuntimeError,"Server dropped connection with message: \"#{response}\""
|
374
|
+
raise RqlRuntimeError, "Server dropped connection with message: \"#{response}\""
|
355
375
|
end
|
356
376
|
|
357
|
-
|
377
|
+
raise RqlDriverError, "Internal driver error, listener already started." \
|
378
|
+
if @listener
|
358
379
|
@listener = Thread.new {
|
359
380
|
while true
|
360
381
|
begin
|
361
|
-
token =
|
382
|
+
token = nil
|
362
383
|
token = @socket.read_exn(8).unpack('q<')[0]
|
363
384
|
response_length = @socket.read_exn(4).unpack('L<')[0]
|
364
385
|
response = @socket.read_exn(response_length)
|
@@ -368,22 +389,14 @@ module RethinkDB
|
|
368
389
|
raise RqlRuntimeError, "Bad response, server is buggy.\n" +
|
369
390
|
"#{e.inspect}\n" + response
|
370
391
|
end
|
371
|
-
|
372
|
-
@mutex.synchronize{@waiters.keys.each{|k| note_data(k, data)}}
|
373
|
-
else
|
374
|
-
@mutex.synchronize{note_data(token, data)}
|
375
|
-
end
|
392
|
+
@listener_mutex.synchronize{note_data(token, data)}
|
376
393
|
rescue Exception => e
|
377
|
-
|
378
|
-
@
|
379
|
-
|
380
|
-
@waiters.keys.each{|k| note_error(k, e)}
|
381
|
-
}
|
394
|
+
@listener_mutex.synchronize {
|
395
|
+
@waiters.keys.each{ |k| note_error(k, e) }
|
396
|
+
@listener = nil
|
382
397
|
Thread.current.terminate
|
383
398
|
abort("unreachable")
|
384
|
-
|
385
|
-
@mutex.synchronize{note_error(token, e)}
|
386
|
-
end
|
399
|
+
}
|
387
400
|
end
|
388
401
|
end
|
389
402
|
}
|
data/lib/ql2.pb.rb
CHANGED
@@ -44,6 +44,7 @@ module RethinkDB
|
|
44
44
|
SUCCESS_PARTIAL = 3
|
45
45
|
SUCCESS_FEED = 5
|
46
46
|
WAIT_COMPLETE = 4
|
47
|
+
SUCCESS_ATOM_FEED = 6
|
47
48
|
CLIENT_ERROR = 16
|
48
49
|
COMPILE_ERROR = 17
|
49
50
|
RUNTIME_ERROR = 18
|
@@ -116,8 +117,8 @@ module RethinkDB
|
|
116
117
|
REDUCE = 37
|
117
118
|
MAP = 38
|
118
119
|
FILTER = 39
|
119
|
-
|
120
|
-
|
120
|
+
CONCAT_MAP = 40
|
121
|
+
ORDER_BY = 41
|
121
122
|
DISTINCT = 42
|
122
123
|
COUNT = 43
|
123
124
|
IS_EMPTY = 86
|
@@ -128,12 +129,13 @@ module RethinkDB
|
|
128
129
|
OUTER_JOIN = 49
|
129
130
|
EQ_JOIN = 50
|
130
131
|
ZIP = 72
|
132
|
+
RANGE = 173
|
131
133
|
INSERT_AT = 82
|
132
134
|
DELETE_AT = 83
|
133
135
|
CHANGE_AT = 84
|
134
136
|
SPLICE_AT = 85
|
135
137
|
COERCE_TO = 51
|
136
|
-
|
138
|
+
TYPE_OF = 52
|
137
139
|
UPDATE = 53
|
138
140
|
DELETE = 54
|
139
141
|
REPLACE = 55
|
@@ -144,6 +146,11 @@ module RethinkDB
|
|
144
146
|
TABLE_CREATE = 60
|
145
147
|
TABLE_DROP = 61
|
146
148
|
TABLE_LIST = 62
|
149
|
+
CONFIG = 174
|
150
|
+
STATUS = 175
|
151
|
+
WAIT = 177
|
152
|
+
RECONFIGURE = 176
|
153
|
+
REBALANCE = 179
|
147
154
|
SYNC = 138
|
148
155
|
INDEX_CREATE = 75
|
149
156
|
INDEX_DROP = 76
|
@@ -155,7 +162,7 @@ module RethinkDB
|
|
155
162
|
BRANCH = 65
|
156
163
|
ANY = 66
|
157
164
|
ALL = 67
|
158
|
-
|
165
|
+
FOR_EACH = 68
|
159
166
|
FUNC = 69
|
160
167
|
ASC = 73
|
161
168
|
DESC = 74
|
@@ -166,6 +173,7 @@ module RethinkDB
|
|
166
173
|
SAMPLE = 81
|
167
174
|
DEFAULT = 92
|
168
175
|
JSON = 98
|
176
|
+
TO_JSON_STRING = 172
|
169
177
|
ISO8601 = 99
|
170
178
|
TO_ISO8601 = 100
|
171
179
|
EPOCH_TIME = 101
|
data/lib/rethinkdb.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
|
-
# Copyright 2010-
|
2
|
-
require 'rubygems'
|
3
|
-
require 'ql2.pb.rb'
|
4
|
-
require 'socket'
|
5
|
-
require 'pp'
|
1
|
+
# Copyright 2010-2014 RethinkDB, all rights reserved.
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
require_relative './ql2.pb.rb'
|
4
|
+
require_relative './exc.rb'
|
5
|
+
require_relative './net.rb'
|
6
|
+
require_relative './shim.rb'
|
7
|
+
require_relative './func.rb'
|
8
|
+
require_relative './rpp.rb'
|
12
9
|
|
13
10
|
module RethinkDB
|
14
11
|
module Shortcuts
|
data/lib/rpp.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'pp'
|
2
1
|
require 'prettyprint'
|
3
2
|
|
4
3
|
module RethinkDB
|
@@ -75,11 +74,8 @@ module RethinkDB
|
|
75
74
|
end
|
76
75
|
|
77
76
|
def self.pp_int_func(q, func, bt)
|
78
|
-
# PP.pp [:func, func.to_json, bt]
|
79
77
|
begin
|
80
|
-
# PP.pp func
|
81
78
|
func_args = func[1][0][1].map{|x| x.to_pb}
|
82
|
-
# PP.pp JSON.parse(func_args.to_json)
|
83
79
|
func_body = func[1][1]
|
84
80
|
q.text(" ")
|
85
81
|
q.group(0, "{", "}") {
|
@@ -108,14 +104,14 @@ module RethinkDB
|
|
108
104
|
else
|
109
105
|
return !["db", "db_create", "db_drop", "json", "funcall", "args", "branch", "http",
|
110
106
|
"binary", "javascript", "random", "time", "iso8601", "epoch_time", "now",
|
111
|
-
"geojson", "point", "circle", "line", "polygon", "asc", "desc", "literal"
|
107
|
+
"geojson", "point", "circle", "line", "polygon", "asc", "desc", "literal",
|
108
|
+
"range"].include?(name)
|
112
109
|
end
|
113
110
|
end
|
114
111
|
def self.pp_int(q, term, bt, pre_dot=false)
|
115
112
|
q.text("\x7", 0) if bt == []
|
116
113
|
|
117
114
|
term = term.to_pb if term.class == RQL
|
118
|
-
# PP.pp [:pp_int, term.to_json, bt]
|
119
115
|
if term.class != Array
|
120
116
|
if term.class == Hash
|
121
117
|
if not pp_pseudotype(q, term, bt)
|
@@ -193,7 +189,6 @@ module RethinkDB
|
|
193
189
|
if args[-1] && args[-1].class == Array && args[-1][0] == Term::TermType::FUNC
|
194
190
|
func_bt = bt_consume(bt, args.size() - 1 + arg_offset)
|
195
191
|
func = args.pop
|
196
|
-
# PP.pp [:func_bt, bt, arg_offset, (args.size() - 1) + arg_offset, func_bt]
|
197
192
|
end
|
198
193
|
|
199
194
|
if args != [] || optargs != {}
|
@@ -208,7 +203,6 @@ module RethinkDB
|
|
208
203
|
q.text(",")
|
209
204
|
q.breakable
|
210
205
|
end
|
211
|
-
# PP.pp [:int, arg.to_json, bt_consume(bt, index)]
|
212
206
|
pp_int(q, arg, bt_consume(bt, index + arg_offset))
|
213
207
|
}
|
214
208
|
if optargs != {}
|
@@ -228,7 +222,6 @@ module RethinkDB
|
|
228
222
|
end
|
229
223
|
|
230
224
|
def self.pp(term, bt=nil)
|
231
|
-
# PP.pp bt
|
232
225
|
begin
|
233
226
|
q = PrettyPrint.new
|
234
227
|
pp_int(q, term, bt, true)
|
data/lib/shim.rb
CHANGED
@@ -59,13 +59,14 @@ module RethinkDB
|
|
59
59
|
rt = Response::ResponseType
|
60
60
|
begin
|
61
61
|
case r['t']
|
62
|
-
when rt::SUCCESS_ATOM
|
63
|
-
when rt::SUCCESS_FEED
|
64
|
-
when rt::
|
65
|
-
when rt::
|
66
|
-
when rt::
|
67
|
-
when rt::
|
68
|
-
when rt::
|
62
|
+
when rt::SUCCESS_ATOM then r['r'][0]
|
63
|
+
when rt::SUCCESS_FEED then r['r']
|
64
|
+
when rt::SUCCESS_ATOM_FEED then r['r']
|
65
|
+
when rt::SUCCESS_PARTIAL then r['r']
|
66
|
+
when rt::SUCCESS_SEQUENCE then r['r']
|
67
|
+
when rt::RUNTIME_ERROR then raise RqlRuntimeError, r['r'][0]
|
68
|
+
when rt::COMPILE_ERROR then raise RqlCompileError, r['r'][0]
|
69
|
+
when rt::CLIENT_ERROR then raise RqlDriverError, r['r'][0]
|
69
70
|
else raise RqlRuntimeError, "Unexpected response: #{r.inspect}"
|
70
71
|
end
|
71
72
|
rescue RqlError => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rethinkdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RethinkDB Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -31,12 +31,12 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- lib/ql2.pb.rb
|
34
|
-
- lib/net.rb
|
35
|
-
- lib/func.rb
|
36
34
|
- lib/exc.rb
|
35
|
+
- lib/func.rb
|
36
|
+
- lib/net.rb
|
37
|
+
- lib/rethinkdb.rb
|
37
38
|
- lib/rpp.rb
|
38
39
|
- lib/shim.rb
|
39
|
-
- lib/rethinkdb.rb
|
40
40
|
homepage: http://rethinkdb.com
|
41
41
|
licenses:
|
42
42
|
- Apache-2
|