tarantool 0.4.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/ext/tarantool/response_c.c +1 -1
- data/lib/tarantool/record/select.rb +2 -1
- data/lib/tarantool/request.rb +10 -2
- data/lib/tarantool/version.rb +2 -2
- data/test/helper.rb +10 -9
- metadata +26 -20
data/Gemfile
CHANGED
data/ext/tarantool/response_c.c
CHANGED
@@ -133,7 +133,7 @@ unpack_tuples(VALUE self, VALUE data, VALUE fields, VALUE _tail, VALUE tuples_af
|
|
133
133
|
}
|
134
134
|
end = str + 8 + *(uint32_t*)str;
|
135
135
|
tuplen = *(uint32_t*)(str+4);
|
136
|
-
tuple = rb_ary_new2(
|
136
|
+
tuple = rb_ary_new2(tuplen);
|
137
137
|
str += 8;
|
138
138
|
len -= 8;
|
139
139
|
for(i = 0; i < tuplen; i++) {
|
@@ -56,13 +56,14 @@ module Tarantool
|
|
56
56
|
|
57
57
|
def auto_shard
|
58
58
|
params = @params.dup
|
59
|
-
params.
|
59
|
+
params.delete :shard
|
60
60
|
self.class.new(@record, params)
|
61
61
|
end
|
62
62
|
|
63
63
|
def all
|
64
64
|
results.dup
|
65
65
|
end
|
66
|
+
alias to_a all
|
66
67
|
|
67
68
|
def first
|
68
69
|
space.select(@params[:where], @params[:offset] || 0, 1).first
|
data/lib/tarantool/request.rb
CHANGED
@@ -253,9 +253,9 @@ module Tarantool
|
|
253
253
|
op = operation[1]
|
254
254
|
op = UPDATE_OPS[op] unless Integer === op
|
255
255
|
raise ArgumentError, "Unknown operation #{operation[1]}" unless op
|
256
|
-
::BinUtils.append_int32_int8_le!(body, field_no, op)
|
257
256
|
case op
|
258
257
|
when 0
|
258
|
+
::BinUtils.append_int32_int8_le!(body, field_no, op)
|
259
259
|
if (type = fields[field_no]).nil?
|
260
260
|
if operation.size == 4 && Symbol === operation.last
|
261
261
|
*operation, type = operation
|
@@ -268,11 +268,13 @@ module Tarantool
|
|
268
268
|
end
|
269
269
|
pack_field(body, type, operation[2])
|
270
270
|
when 1, 2, 3, 4
|
271
|
+
::BinUtils.append_int32_int8_le!(body, field_no, op)
|
271
272
|
unless operation.size == 3 && !operation[2].nil?
|
272
273
|
raise ArgumentError, "wrong arguments for integer operation #{operation.inspect}"
|
273
274
|
end
|
274
275
|
pack_field(body, :sint, operation[2])
|
275
276
|
when 5
|
277
|
+
::BinUtils.append_int32_int8_le!(body, field_no, op)
|
276
278
|
unless operation.size == 5 && !operation[2].nil? && !operation[3].nil?
|
277
279
|
raise ArgumentError, "wrong arguments for slice operation #{operation.inspect}"
|
278
280
|
end
|
@@ -283,9 +285,10 @@ module Tarantool
|
|
283
285
|
::BinUtils.append_bersize_int32_le!(body, operation[3].to_i)
|
284
286
|
::BinUtils.append_bersize_string!(body, str.to_s)
|
285
287
|
when 7
|
286
|
-
old_field_no = field_no +
|
288
|
+
old_field_no = field_no +
|
287
289
|
(inserted ||= []).count{|i| i <= field_no} -
|
288
290
|
(deleted ||= []).count{|i| i <= field_no}
|
291
|
+
::BinUtils.append_int32_int8_le!(body, old_field_no, op)
|
289
292
|
inserted << field_no
|
290
293
|
if (type = fields[old_field_no]).nil?
|
291
294
|
if operation.size == 4 && Symbol === operation.last
|
@@ -299,6 +302,11 @@ module Tarantool
|
|
299
302
|
end
|
300
303
|
pack_field(body, type, operation[2])
|
301
304
|
when 6
|
305
|
+
old_field_no = field_no +
|
306
|
+
(inserted ||= []).count{|i| i <= field_no} -
|
307
|
+
(deleted ||= []).count{|i| i <= field_no}
|
308
|
+
::BinUtils.append_int32_int8_le!(body, old_field_no, op)
|
309
|
+
deleted << field_no
|
302
310
|
body << ZERO
|
303
311
|
# pass
|
304
312
|
end
|
data/lib/tarantool/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'minitest/spec'
|
2
2
|
require 'rr'
|
3
3
|
require 'fileutils'
|
4
|
+
require 'eventmachine'
|
4
5
|
|
5
6
|
require 'tarantool'
|
6
7
|
|
@@ -184,9 +185,10 @@ HSPACE3 = {
|
|
184
185
|
|
185
186
|
module Helper
|
186
187
|
def tarantool_pipe
|
187
|
-
|
188
|
+
#$tarantool_pipe ||= begin
|
189
|
+
begin
|
188
190
|
cnf = {port: 33013, admin: 33015} #TCONFIG
|
189
|
-
tarant = %W{tarantool -p #{cnf[:port]} -
|
191
|
+
tarant = %W{tarantool -p #{cnf[:port]} -a #{cnf[:admin]}}
|
190
192
|
tarant = [{}, *tarant, :err => [:child, :out]]
|
191
193
|
IO.popen(tarant, 'w+').tap{|p| p.sync = true}
|
192
194
|
end
|
@@ -194,10 +196,12 @@ module Helper
|
|
194
196
|
|
195
197
|
def exec_tarantool(cmd, lines_to_read)
|
196
198
|
cmd = cmd.gsub(/^\s+/, '')
|
197
|
-
tarantool_pipe
|
198
|
-
|
199
|
+
pipe = tarantool_pipe
|
200
|
+
pipe.puts(cmd)
|
201
|
+
pipe.flush
|
199
202
|
lines_to_read.times do
|
200
|
-
|
203
|
+
#STDERR.puts pipe.gets
|
204
|
+
pipe.gets
|
201
205
|
end
|
202
206
|
end
|
203
207
|
|
@@ -284,14 +288,11 @@ module Helper
|
|
284
288
|
yield
|
285
289
|
end
|
286
290
|
|
287
|
-
def mock(u, meth, &block)
|
288
|
-
u.define_singleton_method(meth, &block)
|
289
|
-
end
|
290
291
|
end
|
291
292
|
|
292
293
|
class MiniTest::Unit::TestCase
|
293
294
|
include ::Helper
|
294
|
-
include RR::Adapters::MiniTest
|
295
|
+
include ::RR::Adapters::MiniTest
|
295
296
|
end
|
296
297
|
|
297
298
|
class << MiniTest::Spec
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tarantool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.4.4.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andrew Rudenko
|
@@ -10,72 +10,72 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-03-
|
13
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
type: :runtime
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ! '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 0.3.8
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
21
|
none: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.3.8
|
27
|
+
none: false
|
28
|
+
prerelease: false
|
30
29
|
name: iproto
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
30
|
type: :runtime
|
31
|
+
- !ruby/object:Gem::Dependency
|
33
32
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
33
|
requirements:
|
36
34
|
- - ! '>='
|
37
35
|
- !ruby/object:Gem::Version
|
38
36
|
version: 0.1.1
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
none: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
39
|
requirements:
|
43
40
|
- - ! '>='
|
44
41
|
- !ruby/object:Gem::Version
|
45
42
|
version: 0.1.1
|
43
|
+
none: false
|
44
|
+
prerelease: false
|
46
45
|
name: murmurhash3
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
46
|
type: :runtime
|
47
|
+
- !ruby/object:Gem::Dependency
|
49
48
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
49
|
requirements:
|
52
50
|
- - ! '>='
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: 0.0.2
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
53
|
none: false
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
55
|
requirements:
|
59
56
|
- - ! '>='
|
60
57
|
- !ruby/object:Gem::Version
|
61
58
|
version: 0.0.2
|
59
|
+
none: false
|
60
|
+
prerelease: false
|
62
61
|
name: sumbur
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
62
|
type: :runtime
|
63
|
+
- !ruby/object:Gem::Dependency
|
65
64
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
65
|
requirements:
|
68
66
|
- - ~>
|
69
67
|
- !ruby/object:Gem::Version
|
70
68
|
version: 0.0.3
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
69
|
none: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
71
|
requirements:
|
75
72
|
- - ~>
|
76
73
|
- !ruby/object:Gem::Version
|
77
74
|
version: 0.0.3
|
75
|
+
none: false
|
76
|
+
prerelease: false
|
78
77
|
name: bin_utils
|
78
|
+
type: :runtime
|
79
79
|
description: Tarantool KV-storage client.
|
80
80
|
email:
|
81
81
|
- ceo@prepor.ru
|
@@ -150,17 +150,23 @@ require_paths:
|
|
150
150
|
- lib
|
151
151
|
- ext
|
152
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
153
|
requirements:
|
155
154
|
- - ! '>='
|
156
155
|
- !ruby/object:Gem::Version
|
156
|
+
hash: -252277814378406513
|
157
157
|
version: '0'
|
158
|
-
|
158
|
+
segments:
|
159
|
+
- 0
|
159
160
|
none: false
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
162
|
requirements:
|
161
163
|
- - ! '>='
|
162
164
|
- !ruby/object:Gem::Version
|
165
|
+
hash: -252277814378406513
|
163
166
|
version: '0'
|
167
|
+
segments:
|
168
|
+
- 0
|
169
|
+
none: false
|
164
170
|
requirements: []
|
165
171
|
rubyforge_project:
|
166
172
|
rubygems_version: 1.8.23
|