Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Backward incompatible!!! tarantool changes inserted/deleted fields

make tests pass
  • Loading branch information...
commit 029395050aed972d2a8934260dbc9efc9534415d 1 parent 3bb8d00
@funny-falcon funny-falcon authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/tarantool/request.rb
View
12 lib/tarantool/request.rb
@@ -253,9 +253,9 @@ def _pack_operations(body, operations, fields)
op = operation[1]
op = UPDATE_OPS[op] unless Integer === op
raise ArgumentError, "Unknown operation #{operation[1]}" unless op
- ::BinUtils.append_int32_int8_le!(body, field_no, op)
case op
when 0
+ ::BinUtils.append_int32_int8_le!(body, field_no, op)
if (type = fields[field_no]).nil?
if operation.size == 4 && Symbol === operation.last
*operation, type = operation
@@ -268,11 +268,13 @@ def _pack_operations(body, operations, fields)
end
pack_field(body, type, operation[2])
when 1, 2, 3, 4
+ ::BinUtils.append_int32_int8_le!(body, field_no, op)
unless operation.size == 3 && !operation[2].nil?
raise ArgumentError, "wrong arguments for integer operation #{operation.inspect}"
end
pack_field(body, :sint, operation[2])
when 5
+ ::BinUtils.append_int32_int8_le!(body, field_no, op)
unless operation.size == 5 && !operation[2].nil? && !operation[3].nil?
raise ArgumentError, "wrong arguments for slice operation #{operation.inspect}"
end
@@ -283,9 +285,10 @@ def _pack_operations(body, operations, fields)
::BinUtils.append_bersize_int32_le!(body, operation[3].to_i)
::BinUtils.append_bersize_string!(body, str.to_s)
when 7
- old_field_no = field_no +
+ old_field_no = field_no +
(inserted ||= []).count{|i| i <= field_no} -
(deleted ||= []).count{|i| i <= field_no}
+ ::BinUtils.append_int32_int8_le!(body, old_field_no, op)
inserted << field_no
if (type = fields[old_field_no]).nil?
if operation.size == 4 && Symbol === operation.last
@@ -299,6 +302,11 @@ def _pack_operations(body, operations, fields)
end
pack_field(body, type, operation[2])
when 6
+ old_field_no = field_no +
+ (inserted ||= []).count{|i| i <= field_no} -
+ (deleted ||= []).count{|i| i <= field_no}
+ ::BinUtils.append_int32_int8_le!(body, old_field_no, op)
+ deleted << field_no
body << ZERO
# pass
end
Please sign in to comment.
Something went wrong with that request. Please try again.