tarantool 0.4.3 → 0.4.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -59,10 +59,12 @@ module Tarantool
59
59
  @tarantool._send_request(shard_numbers, read_write, cb)
60
60
  end
61
61
 
62
+ BINARY = ::Encoding::BINARY
62
63
  def _select(space_no, index_no, offset, limit, keys, cb, fields, index_fields, shard_nums, translators = [])
63
64
  get_tuples = limit == :first ? (limit = 1; :first) : :all
64
65
  keys = [*keys]
65
- body = [space_no, index_no, offset, limit, keys.size].pack(SELECT_HEADER)
66
+ body = ''.force_encoding(BINARY)
67
+ ::BinUtils.append_int32_le!(body, space_no, index_no, offset, limit, keys.size)
66
68
 
67
69
  for key in keys
68
70
  pack_tuple(body, key, index_fields, index_no)
@@ -135,25 +137,25 @@ module Tarantool
135
137
  when :sint
136
138
  value = value.to_i
137
139
  _raise_integer_overflow(value, MIN_SINT32, MAX_SINT32) if value > MAX_SINT32 or value < MIN_SINT32
138
- ::BinUtils.append_bersize_sint32_le!(body, value)
140
+ ::BinUtils.append_bersize_int32_le!(body, value)
139
141
  when :sint64
140
142
  value = value.to_i
141
143
  _raise_integer_overflow(value, MIN_SINT64, MAX_SINT64) if value > MAX_SINT64 or value < MIN_SINT64
142
- ::BinUtils.append_bersize_sint64_le!(body, value)
144
+ ::BinUtils.append_bersize_int64_le!(body, value)
143
145
  when :sint16
144
146
  value = value.to_i
145
147
  _raise_integer_overflow(value, MIN_SINT16, MAX_SINT16) if value > MAX_SINT16 or value < MIN_SINT16
146
- ::BinUtils.append_bersize_sint16_le!(body, value)
148
+ ::BinUtils.append_bersize_int16_le!(body, value)
147
149
  when :sint8
148
150
  value = value.to_i
149
151
  _raise_integer_overflow(value, MIN_SINT8, MAX_SINT8) if value > MAX_SINT8 or value < MIN_SINT8
150
- ::BinUtils.append_bersize_sint8!(body, value)
152
+ ::BinUtils.append_bersize_int8!(body, value)
151
153
  when :varint
152
154
  value = value.to_i
153
155
  if 0 <= value && value < MAX_INT32
154
156
  ::BinUtils.append_bersize_int32_le!(body, value)
155
157
  else
156
- ::BinUtils.append_bersize_sint64_le!(body, value)
158
+ ::BinUtils.append_bersize_int64_le!(body, value)
157
159
  end
158
160
  when :error
159
161
  raise IndexIndexError
@@ -185,12 +187,14 @@ module Tarantool
185
187
  _send_request(shard_nums, read_write, response)
186
188
  end
187
189
 
190
+
188
191
  def _insert(space_no, flags, tuple, fields, cb, ret_tuple, shard_nums, in_any_shard = nil, translators = [])
189
192
  flags |= BOX_RETURN_TUPLE if ret_tuple
190
193
  fields = [*fields]
191
194
 
192
195
  tuple = [*tuple]
193
- body = [space_no, flags].pack(INSERT_HEADER)
196
+ body = ''.force_encoding(BINARY)
197
+ ::BinUtils.append_int32_le!(body, space_no, flags)
194
198
  pack_tuple(body, tuple, fields, :space)
195
199
 
196
200
  _modify_request(REQUEST_INSERT, body, fields, ret_tuple, cb, shard_nums,
@@ -204,7 +208,8 @@ module Tarantool
204
208
  operations = [operations]
205
209
  end
206
210
 
207
- body = [space_no, flags].pack(UPDATE_HEADER)
211
+ body = ''.force_encoding(BINARY)
212
+ ::BinUtils.append_int32_le!(body, space_no, flags)
208
213
  pack_tuple(body, pk, pk_fields, 0)
209
214
  ::BinUtils.append_int32_le!(body, operations.size)
210
215
 
@@ -234,7 +239,7 @@ module Tarantool
234
239
  if operation.size == 2
235
240
  if (Integer === field_no || field_no =~ /\A\d/)
236
241
  unless Symbol === operation[1] && UPDATE_OPS[operation[1]] == 6
237
- body << [field_no, 0].pack(UPDATE_FIELDNO_OP)
242
+ ::BinUtils.append_int32_int8_le!(body, field_no, 0)
238
243
  type = fields[field_no] || get_tail_item(fields, field_no, tail) ||
239
244
  _detect_type(operation[1])
240
245
  pack_field(body, type, operation[1])
@@ -251,7 +256,7 @@ module Tarantool
251
256
  op = operation[1]
252
257
  op = UPDATE_OPS[op] unless Integer === op
253
258
  raise ArgumentError, "Unknown operation #{operation[1]}" unless op
254
- body << [field_no, op].pack(UPDATE_FIELDNO_OP)
259
+ ::BinUtils.append_int32_int8_le!(body, field_no, op)
255
260
  case op
256
261
  when 0
257
262
  if (type = fields[field_no]).nil?
@@ -277,8 +282,8 @@ module Tarantool
277
282
 
278
283
  str = operation[4].to_s
279
284
  ::BinUtils.append_ber!(body, 10 + ber_size(str.bytesize) + str.bytesize)
280
- ::BinUtils.append_bersize_sint32_le!(body, operation[2].to_i)
281
- ::BinUtils.append_bersize_sint32_le!(body, operation[3].to_i)
285
+ ::BinUtils.append_bersize_int32_le!(body, operation[2].to_i)
286
+ ::BinUtils.append_bersize_int32_le!(body, operation[3].to_i)
282
287
  ::BinUtils.append_bersize_string!(body, str.to_s)
283
288
  when 7
284
289
  old_field_no = field_no +
@@ -306,7 +311,8 @@ module Tarantool
306
311
  def _delete(space_no, pk, fields, pk_fields, cb, ret_tuple, shard_nums, translators = [])
307
312
  flags = ret_tuple ? BOX_RETURN_TUPLE : 0
308
313
 
309
- body = [space_no, flags].pack(DELETE_HEADER)
314
+ body = ''.force_encoding(BINARY)
315
+ ::BinUtils.append_int32_le!(body, space_no, flags)
310
316
  pack_tuple(body, pk, pk_fields, 0)
311
317
 
312
318
  _modify_request(REQUEST_DELETE, body, fields, ret_tuple, cb, shard_nums, :write, translators)
@@ -349,7 +355,9 @@ module Tarantool
349
355
  return_types = [*opts[:returns] || TYPES_AUTO]
350
356
 
351
357
  func_name = func_name.to_s
352
- body = [flags, func_name.size, func_name].pack(CALL_HEADER)
358
+ body = ''.force_encoding(BINARY)
359
+ ::BinUtils.append_int32_le!(body, flags)
360
+ ::BinUtils.append_bersize_string!(body, func_name)
353
361
  pack_tuple(body, values, value_types, :func_call)
354
362
 
355
363
  shard_nums = opts[:shards] || all_shards
@@ -1,4 +1,4 @@
1
1
  module Tarantool
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.3.1"
3
3
  RECORD_VERSION = "0.4.1.2"
4
4
  end
data/test/run_all.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  Dir.glob(File.expand_path('../test*.rb', __FILE__)) do |f|
2
- require f unless f =~ /shard/
2
+ require f # unless f =~ /shard/
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarantool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-06 00:00:00.000000000 Z
13
+ date: 2012-08-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: iproto
@@ -67,7 +67,7 @@ dependencies:
67
67
  requirements:
68
68
  - - ! '>='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.0.1
70
+ version: 0.0.2
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -75,7 +75,7 @@ dependencies:
75
75
  requirements:
76
76
  - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
- version: 0.0.1
78
+ version: 0.0.2
79
79
  description: Tarantool KV-storage client.
80
80
  email:
81
81
  - ceo@prepor.ru