cql-rb 2.0.0.pre0 → 2.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -2
  3. data/lib/cql.rb +8 -3
  4. data/lib/cql/client.rb +21 -356
  5. data/lib/cql/client/authenticators.rb +70 -0
  6. data/lib/cql/client/batch.rb +54 -0
  7. data/lib/cql/client/{asynchronous_client.rb → client.rb} +241 -6
  8. data/lib/cql/client/connector.rb +3 -2
  9. data/lib/cql/client/{asynchronous_prepared_statement.rb → prepared_statement.rb} +103 -0
  10. data/lib/cql/protocol.rb +1 -2
  11. data/lib/cql/protocol/cql_byte_buffer.rb +285 -0
  12. data/lib/cql/protocol/cql_protocol_handler.rb +3 -3
  13. data/lib/cql/protocol/frame_decoder.rb +3 -3
  14. data/lib/cql/protocol/frame_encoder.rb +2 -2
  15. data/lib/cql/protocol/request.rb +0 -2
  16. data/lib/cql/protocol/requests/auth_response_request.rb +2 -2
  17. data/lib/cql/protocol/requests/batch_request.rb +10 -10
  18. data/lib/cql/protocol/requests/credentials_request.rb +2 -2
  19. data/lib/cql/protocol/requests/execute_request.rb +13 -13
  20. data/lib/cql/protocol/requests/options_request.rb +2 -2
  21. data/lib/cql/protocol/requests/prepare_request.rb +2 -2
  22. data/lib/cql/protocol/requests/query_request.rb +13 -13
  23. data/lib/cql/protocol/requests/register_request.rb +2 -2
  24. data/lib/cql/protocol/requests/startup_request.rb +2 -2
  25. data/lib/cql/protocol/response.rb +2 -4
  26. data/lib/cql/protocol/responses/auth_challenge_response.rb +2 -2
  27. data/lib/cql/protocol/responses/auth_success_response.rb +2 -2
  28. data/lib/cql/protocol/responses/authenticate_response.rb +2 -2
  29. data/lib/cql/protocol/responses/detailed_error_response.rb +15 -15
  30. data/lib/cql/protocol/responses/error_response.rb +4 -4
  31. data/lib/cql/protocol/responses/event_response.rb +3 -3
  32. data/lib/cql/protocol/responses/prepared_result_response.rb +4 -4
  33. data/lib/cql/protocol/responses/raw_rows_result_response.rb +1 -1
  34. data/lib/cql/protocol/responses/ready_response.rb +1 -1
  35. data/lib/cql/protocol/responses/result_response.rb +3 -3
  36. data/lib/cql/protocol/responses/rows_result_response.rb +22 -22
  37. data/lib/cql/protocol/responses/schema_change_event_response.rb +2 -2
  38. data/lib/cql/protocol/responses/schema_change_result_response.rb +2 -2
  39. data/lib/cql/protocol/responses/set_keyspace_result_response.rb +2 -2
  40. data/lib/cql/protocol/responses/status_change_event_response.rb +2 -2
  41. data/lib/cql/protocol/responses/supported_response.rb +2 -2
  42. data/lib/cql/protocol/responses/void_result_response.rb +1 -1
  43. data/lib/cql/protocol/type_converter.rb +78 -81
  44. data/lib/cql/time_uuid.rb +6 -0
  45. data/lib/cql/uuid.rb +2 -1
  46. data/lib/cql/version.rb +1 -1
  47. data/spec/cql/client/batch_spec.rb +8 -8
  48. data/spec/cql/client/{asynchronous_client_spec.rb → client_spec.rb} +162 -0
  49. data/spec/cql/client/connector_spec.rb +13 -3
  50. data/spec/cql/client/{asynchronous_prepared_statement_spec.rb → prepared_statement_spec.rb} +148 -1
  51. data/spec/cql/client/request_runner_spec.rb +2 -2
  52. data/spec/cql/protocol/cql_byte_buffer_spec.rb +895 -0
  53. data/spec/cql/protocol/cql_protocol_handler_spec.rb +1 -1
  54. data/spec/cql/protocol/frame_decoder_spec.rb +14 -14
  55. data/spec/cql/protocol/frame_encoder_spec.rb +7 -7
  56. data/spec/cql/protocol/requests/auth_response_request_spec.rb +4 -4
  57. data/spec/cql/protocol/requests/batch_request_spec.rb +21 -21
  58. data/spec/cql/protocol/requests/credentials_request_spec.rb +2 -2
  59. data/spec/cql/protocol/requests/execute_request_spec.rb +13 -13
  60. data/spec/cql/protocol/requests/options_request_spec.rb +1 -1
  61. data/spec/cql/protocol/requests/prepare_request_spec.rb +2 -2
  62. data/spec/cql/protocol/requests/query_request_spec.rb +13 -13
  63. data/spec/cql/protocol/requests/register_request_spec.rb +2 -2
  64. data/spec/cql/protocol/requests/startup_request_spec.rb +4 -4
  65. data/spec/cql/protocol/responses/auth_challenge_response_spec.rb +5 -5
  66. data/spec/cql/protocol/responses/auth_success_response_spec.rb +5 -5
  67. data/spec/cql/protocol/responses/authenticate_response_spec.rb +3 -3
  68. data/spec/cql/protocol/responses/detailed_error_response_spec.rb +15 -15
  69. data/spec/cql/protocol/responses/error_response_spec.rb +5 -5
  70. data/spec/cql/protocol/responses/event_response_spec.rb +8 -8
  71. data/spec/cql/protocol/responses/prepared_result_response_spec.rb +7 -7
  72. data/spec/cql/protocol/responses/raw_rows_result_response_spec.rb +1 -1
  73. data/spec/cql/protocol/responses/ready_response_spec.rb +2 -2
  74. data/spec/cql/protocol/responses/result_response_spec.rb +16 -16
  75. data/spec/cql/protocol/responses/rows_result_response_spec.rb +21 -21
  76. data/spec/cql/protocol/responses/schema_change_event_response_spec.rb +3 -3
  77. data/spec/cql/protocol/responses/schema_change_result_response_spec.rb +3 -3
  78. data/spec/cql/protocol/responses/set_keyspace_result_response_spec.rb +2 -2
  79. data/spec/cql/protocol/responses/status_change_event_response_spec.rb +3 -3
  80. data/spec/cql/protocol/responses/supported_response_spec.rb +3 -3
  81. data/spec/cql/protocol/responses/topology_change_event_response_spec.rb +3 -3
  82. data/spec/cql/protocol/responses/void_result_response_spec.rb +2 -2
  83. data/spec/cql/protocol/type_converter_spec.rb +25 -13
  84. data/spec/cql/time_uuid_spec.rb +17 -4
  85. data/spec/cql/uuid_spec.rb +5 -1
  86. data/spec/integration/protocol_spec.rb +48 -42
  87. data/spec/spec_helper.rb +0 -1
  88. metadata +27 -39
  89. data/lib/cql/byte_buffer.rb +0 -177
  90. data/lib/cql/client/synchronous_client.rb +0 -79
  91. data/lib/cql/client/synchronous_prepared_statement.rb +0 -63
  92. data/lib/cql/future.rb +0 -515
  93. data/lib/cql/io.rb +0 -15
  94. data/lib/cql/io/connection.rb +0 -220
  95. data/lib/cql/io/io_reactor.rb +0 -349
  96. data/lib/cql/protocol/decoding.rb +0 -187
  97. data/lib/cql/protocol/encoding.rb +0 -114
  98. data/spec/cql/byte_buffer_spec.rb +0 -337
  99. data/spec/cql/client/synchronous_client_spec.rb +0 -170
  100. data/spec/cql/client/synchronous_prepared_statement_spec.rb +0 -155
  101. data/spec/cql/future_spec.rb +0 -737
  102. data/spec/cql/io/connection_spec.rb +0 -484
  103. data/spec/cql/io/io_reactor_spec.rb +0 -402
  104. data/spec/cql/protocol/decoding_spec.rb +0 -547
  105. data/spec/cql/protocol/encoding_spec.rb +0 -386
  106. data/spec/integration/io_spec.rb +0 -283
  107. data/spec/support/fake_server.rb +0 -106
data/lib/cql/protocol.rb CHANGED
@@ -41,8 +41,7 @@ module Cql
41
41
  end
42
42
  end
43
43
 
44
- require 'cql/protocol/encoding'
45
- require 'cql/protocol/decoding'
44
+ require 'cql/protocol/cql_byte_buffer'
46
45
  require 'cql/protocol/type_converter'
47
46
  require 'cql/protocol/response'
48
47
  require 'cql/protocol/responses/auth_challenge_response'
@@ -0,0 +1,285 @@
1
+ # encoding: utf-8
2
+
3
+ require 'bigdecimal'
4
+
5
+
6
+ module Cql
7
+ module Protocol
8
+ class CqlByteBuffer < Ione::ByteBuffer
9
+ def read_unsigned_byte
10
+ read_byte
11
+ rescue RangeError => e
12
+ raise DecodingError, e.message, e.backtrace
13
+ end
14
+
15
+ def read_varint(len=bytesize, signed=true)
16
+ bytes = read(len)
17
+ n = 0
18
+ bytes.each_byte do |b|
19
+ n = (n << 8) | b
20
+ end
21
+ if signed && bytes.getbyte(0) & 0x80 == 0x80
22
+ n -= 2**(bytes.length * 8)
23
+ end
24
+ n
25
+ rescue RangeError => e
26
+ raise DecodingError, e.message, e.backtrace
27
+ end
28
+
29
+ def read_decimal(len=bytesize)
30
+ size = read_signed_int
31
+ number_string = read_varint(len - 4).to_s
32
+ if number_string.length < size
33
+ if number_string.start_with?(MINUS)
34
+ number_string = number_string[1, number_string.length - 1]
35
+ fraction_string = MINUS + ZERO << DECIMAL_POINT
36
+ else
37
+ fraction_string = ZERO + DECIMAL_POINT
38
+ end
39
+ (size - number_string.length).times { fraction_string << ZERO }
40
+ fraction_string << number_string
41
+ else
42
+ fraction_string = number_string[0, number_string.length - size]
43
+ fraction_string << DECIMAL_POINT
44
+ fraction_string << number_string[number_string.length - size, number_string.length]
45
+ end
46
+ BigDecimal.new(fraction_string)
47
+ rescue DecodingError => e
48
+ raise DecodingError, e.message, e.backtrace
49
+ end
50
+
51
+ def read_long
52
+ top, bottom = read(8).unpack(Formats::TWO_INTS_FORMAT)
53
+ return (top << 32) | bottom if top <= 0x7fffffff
54
+ top ^= 0xffffffff
55
+ bottom ^= 0xffffffff
56
+ -((top << 32) | bottom) - 1
57
+ rescue RangeError => e
58
+ raise DecodingError, e.message, e.backtrace
59
+ end
60
+
61
+ def read_double
62
+ read(8).unpack(Formats::DOUBLE_FORMAT).first
63
+ rescue RangeError => e
64
+ raise DecodingError, "Not enough bytes available to decode a double: #{e.message}", e.backtrace
65
+ end
66
+
67
+ def read_float
68
+ read(4).unpack(Formats::FLOAT_FORMAT).first
69
+ rescue RangeError => e
70
+ raise DecodingError, "Not enough bytes available to decode a float: #{e.message}", e.backtrace
71
+ end
72
+
73
+ def read_signed_int
74
+ n = read_int
75
+ return n if n <= 0x7fffffff
76
+ n - 0xffffffff - 1
77
+ rescue RangeError => e
78
+ raise DecodingError, "Not enough bytes available to decode an int: #{e.message}", e.backtrace
79
+ end
80
+
81
+ def read_unsigned_short
82
+ read_short
83
+ rescue RangeError => e
84
+ raise DecodingError, "Not enough bytes available to decode a short: #{e.message}", e.backtrace
85
+ end
86
+
87
+ def read_string
88
+ length = read_unsigned_short
89
+ string = read(length)
90
+ string.force_encoding(::Encoding::UTF_8)
91
+ string
92
+ rescue RangeError => e
93
+ raise DecodingError, "Not enough bytes available to decode a string: #{e.message}", e.backtrace
94
+ end
95
+
96
+ def read_long_string
97
+ length = read_signed_int
98
+ string = read(length)
99
+ string.force_encoding(::Encoding::UTF_8)
100
+ string
101
+ rescue RangeError => e
102
+ raise DecodingError, "Not enough bytes available to decode a long string: #{e.message}", e.backtrace
103
+ end
104
+
105
+ def read_uuid(impl=Uuid)
106
+ impl.new(read_varint(16, false))
107
+ rescue DecodingError => e
108
+ raise DecodingError, "Not enough bytes available to decode a UUID: #{e.message}", e.backtrace
109
+ end
110
+
111
+ def read_string_list
112
+ size = read_unsigned_short
113
+ Array.new(size) { read_string }
114
+ end
115
+
116
+ def read_bytes
117
+ size = read_signed_int
118
+ return nil if size & 0x80000000 == 0x80000000
119
+ read(size)
120
+ rescue RangeError => e
121
+ raise DecodingError, "Not enough bytes available to decode a bytes: #{e.message}", e.backtrace
122
+ end
123
+
124
+ def read_short_bytes
125
+ size = read_unsigned_short
126
+ return nil if size & 0x8000 == 0x8000
127
+ read(size)
128
+ rescue RangeError => e
129
+ raise DecodingError, "Not enough bytes available to decode a short bytes: #{e.message}", e.backtrace
130
+ end
131
+
132
+ def read_option
133
+ id = read_unsigned_short
134
+ value = nil
135
+ if block_given?
136
+ value = yield id, self
137
+ end
138
+ [id, value]
139
+ end
140
+
141
+ def read_inet
142
+ size = read_byte
143
+ ip_addr = IPAddr.new_ntoh(read(size))
144
+ port = read_int
145
+ [ip_addr, port]
146
+ rescue RangeError => e
147
+ raise DecodingError, "Not enough bytes available to decode an INET: #{e.message}", e.backtrace
148
+ end
149
+
150
+ def read_consistency
151
+ index = read_unsigned_short
152
+ raise DecodingError, "Unknown consistency index #{index}" if index >= CONSISTENCIES.size || CONSISTENCIES[index].nil?
153
+ CONSISTENCIES[index]
154
+ end
155
+
156
+ def read_string_map
157
+ map = {}
158
+ map_size = read_unsigned_short
159
+ map_size.times do
160
+ key = read_string
161
+ map[key] = read_string
162
+ end
163
+ map
164
+ end
165
+
166
+ def read_string_multimap
167
+ map = {}
168
+ map_size = read_unsigned_short
169
+ map_size.times do
170
+ key = read_string
171
+ map[key] = read_string_list
172
+ end
173
+ map
174
+ end
175
+
176
+ def append_int(n)
177
+ append([n].pack(Formats::INT_FORMAT))
178
+ end
179
+
180
+ def append_short(n)
181
+ append([n].pack(Formats::SHORT_FORMAT))
182
+ end
183
+
184
+ def append_string(str)
185
+ str = str.to_s
186
+ append_short(str.bytesize)
187
+ append(str)
188
+ end
189
+
190
+ def append_long_string(str)
191
+ append_int(str.bytesize)
192
+ append(str)
193
+ end
194
+
195
+ def append_uuid(uuid)
196
+ v = uuid.value
197
+ append_int((v >> 96) & 0xffffffff)
198
+ append_int((v >> 64) & 0xffffffff)
199
+ append_int((v >> 32) & 0xffffffff)
200
+ append_int((v >> 0) & 0xffffffff)
201
+ end
202
+
203
+ def append_string_list(strs)
204
+ append_short(strs.size)
205
+ strs.each do |str|
206
+ append_string(str)
207
+ end
208
+ self
209
+ end
210
+
211
+ def append_bytes(bytes)
212
+ if bytes
213
+ append_int(bytes.bytesize)
214
+ append(bytes)
215
+ else
216
+ append_int(-1)
217
+ end
218
+ end
219
+
220
+ def append_short_bytes(bytes)
221
+ if bytes
222
+ append_short(bytes.bytesize)
223
+ append(bytes)
224
+ else
225
+ append_short(-1)
226
+ end
227
+ end
228
+
229
+ def append_consistency(consistency)
230
+ index = CONSISTENCIES.index(consistency)
231
+ raise EncodingError, %(Unknown consistency "#{consistency}") if index.nil? || CONSISTENCIES[index].nil?
232
+ append_short(index)
233
+ end
234
+
235
+ def append_string_map(map)
236
+ append_short(map.size)
237
+ map.each do |key, value|
238
+ append_string(key)
239
+ append_string(value)
240
+ end
241
+ self
242
+ end
243
+
244
+ def append_long(n)
245
+ top = n >> 32
246
+ bottom = n & 0xffffffff
247
+ append_int(top)
248
+ append_int(bottom)
249
+ end
250
+
251
+ def append_varint(n)
252
+ num = n
253
+ bytes = []
254
+ until num == 0
255
+ bytes << (num & 0xff)
256
+ num = num >> 8
257
+ break if num == -1
258
+ end
259
+ append(bytes.reverse.pack(Formats::BYTES_FORMAT))
260
+ end
261
+
262
+ def append_decimal(n)
263
+ sign, number_string, _, size = n.split
264
+ num = number_string.to_i
265
+ raw = self.class.new.append_varint(sign * num)
266
+ append_int(number_string.length - size)
267
+ append(raw)
268
+ end
269
+
270
+ def append_double(n)
271
+ append([n].pack(Formats::DOUBLE_FORMAT))
272
+ end
273
+
274
+ def append_float(n)
275
+ append([n].pack(Formats::FLOAT_FORMAT))
276
+ end
277
+
278
+ private
279
+
280
+ MINUS = '-'.freeze
281
+ ZERO = '0'.freeze
282
+ DECIMAL_POINT = '.'.freeze
283
+ end
284
+ end
285
+ end
@@ -26,7 +26,7 @@ module Cql
26
26
  @connection.on_data(&method(:receive_data))
27
27
  @connection.on_closed(&method(:socket_closed))
28
28
  @promises = Array.new(128) { nil }
29
- @read_buffer = ByteBuffer.new
29
+ @read_buffer = CqlByteBuffer.new
30
30
  @frame_encoder = FrameEncoder.new(protocol_version, @compressor)
31
31
  @frame_decoder = FrameDecoder.new(@compressor)
32
32
  @current_frame = FrameDecoder::NULL_FRAME
@@ -129,7 +129,7 @@ module Cql
129
129
  end
130
130
  else
131
131
  @lock.synchronize do
132
- promise.encode_frame!
132
+ promise.encode_frame
133
133
  @request_queue_in << promise
134
134
  end
135
135
  end
@@ -173,7 +173,7 @@ module Cql
173
173
  end
174
174
  end
175
175
 
176
- def encode_frame!
176
+ def encode_frame
177
177
  @frame = @frame_encoder.encode_frame(@request)
178
178
  end
179
179
  end
@@ -44,8 +44,8 @@ module Cql
44
44
  size = buffer.size
45
45
  end
46
46
  extra_length = buffer.length - size
47
- trace_id = tracing == 2 ? Decoding.read_uuid!(buffer) : nil
48
- response = Response.decode!(opcode, protocol_version, buffer, size, trace_id)
47
+ trace_id = tracing == 2 ? buffer.read_uuid : nil
48
+ response = Response.decode(opcode, protocol_version, buffer, size, trace_id)
49
49
  if buffer.length > extra_length
50
50
  buffer.discard(buffer.length - extra_length)
51
51
  end
@@ -55,7 +55,7 @@ module Cql
55
55
  def decompress(buffer, size)
56
56
  if @compressor
57
57
  compressed_body = buffer.read(size)
58
- ByteBuffer.new(@compressor.decompress(compressed_body))
58
+ CqlByteBuffer.new(@compressor.decompress(compressed_body))
59
59
  else
60
60
  raise UnexpectedCompressionError, 'Compressed frame received, but no compressor configured'
61
61
  end
@@ -11,9 +11,9 @@ module Cql
11
11
 
12
12
  def encode_frame(request, stream_id=0, buffer=nil)
13
13
  raise InvalidStreamIdError, 'The stream ID must be between 0 and 127' unless 0 <= stream_id && stream_id < 128
14
- buffer ||= ByteBuffer.new
14
+ buffer ||= CqlByteBuffer.new
15
15
  flags = request.trace? ? 2 : 0
16
- body = request.write(@protocol_version, ByteBuffer.new)
16
+ body = request.write(@protocol_version, CqlByteBuffer.new)
17
17
  if @compressor && request.compressable? && @compressor.compress?(body)
18
18
  flags |= 1
19
19
  body = @compressor.compress(body)
@@ -3,8 +3,6 @@
3
3
  module Cql
4
4
  module Protocol
5
5
  class Request
6
- include Encoding
7
-
8
6
  attr_reader :opcode, :trace
9
7
 
10
8
  def initialize(opcode, trace=false)
@@ -10,8 +10,8 @@ module Cql
10
10
  @token = token
11
11
  end
12
12
 
13
- def write(protocol_version, io)
14
- write_bytes(io, @token)
13
+ def write(protocol_version, buffer)
14
+ buffer.append_bytes(@token)
15
15
  end
16
16
 
17
17
  def to_s
@@ -13,31 +13,31 @@ module Cql
13
13
  super(0x0D, trace)
14
14
  @type = type
15
15
  @part_count = 0
16
- @encoded_queries = ByteBuffer.new
16
+ @encoded_queries = CqlByteBuffer.new
17
17
  @consistency = consistency
18
18
  end
19
19
 
20
20
  def add_query(cql, values=nil, type_hints=nil)
21
- @encoded_queries << QUERY_KIND
22
- write_long_string(@encoded_queries, cql)
21
+ @encoded_queries.append(QUERY_KIND)
22
+ @encoded_queries.append_long_string(cql)
23
23
  QueryRequest.encode_values(@encoded_queries, values, type_hints)
24
24
  @part_count += 1
25
25
  nil
26
26
  end
27
27
 
28
28
  def add_prepared(id, metadata, values)
29
- @encoded_queries << PREPARED_KIND
30
- write_short_bytes(@encoded_queries, id)
29
+ @encoded_queries.append(PREPARED_KIND)
30
+ @encoded_queries.append_short_bytes(id)
31
31
  ExecuteRequest.encode_values(@encoded_queries, metadata, values)
32
32
  @part_count += 1
33
33
  nil
34
34
  end
35
35
 
36
- def write(protocol_version, io)
37
- io << @type.chr
38
- write_short(io, @part_count)
39
- io << @encoded_queries
40
- write_consistency(io, @consistency)
36
+ def write(protocol_version, buffer)
37
+ buffer.append(@type.chr)
38
+ buffer.append_short(@part_count)
39
+ buffer.append(@encoded_queries)
40
+ buffer.append_consistency(@consistency)
41
41
  end
42
42
 
43
43
  def to_s
@@ -10,8 +10,8 @@ module Cql
10
10
  @credentials = credentials.dup.freeze
11
11
  end
12
12
 
13
- def write(protocol_version, io)
14
- write_string_map(io, @credentials)
13
+ def write(protocol_version, buffer)
14
+ buffer.append_string_map(@credentials)
15
15
  end
16
16
 
17
17
  def to_s
@@ -19,31 +19,31 @@ module Cql
19
19
  @serial_consistency = serial_consistency
20
20
  @page_size = page_size
21
21
  @paging_state = paging_state
22
- @encoded_values = self.class.encode_values('', @metadata, @values)
22
+ @encoded_values = self.class.encode_values(CqlByteBuffer.new, @metadata, @values)
23
23
  end
24
24
 
25
- def write(protocol_version, io)
26
- write_short_bytes(io, @id)
25
+ def write(protocol_version, buffer)
26
+ buffer.append_short_bytes(@id)
27
27
  if protocol_version > 1
28
- write_consistency(io, @consistency)
28
+ buffer.append_consistency(@consistency)
29
29
  flags = 0
30
30
  flags |= 0x01 if @values.size > 0
31
31
  flags |= 0x02 unless @request_metadata
32
32
  flags |= 0x04 if @page_size
33
33
  flags |= 0x08 if @paging_state
34
34
  flags |= 0x10 if @serial_consistency
35
- io << flags.chr
35
+ buffer.append(flags.chr)
36
36
  if @values.size > 0
37
- io << @encoded_values
37
+ buffer.append(@encoded_values)
38
38
  end
39
- write_int(io, @page_size) if @page_size
40
- write_bytes(io, @paging_state) if @paging_state
41
- write_consistency(io, @serial_consistency) if @serial_consistency
42
- io
39
+ buffer.append_int(@page_size) if @page_size
40
+ buffer.append_bytes(@paging_state) if @paging_state
41
+ buffer.append_consistency(@serial_consistency) if @serial_consistency
43
42
  else
44
- io << @encoded_values
45
- write_consistency(io, @consistency)
43
+ buffer.append(@encoded_values)
44
+ buffer.append_consistency(@consistency)
46
45
  end
46
+ buffer
47
47
  end
48
48
 
49
49
  def to_s
@@ -71,7 +71,7 @@ module Cql
71
71
  end
72
72
 
73
73
  def self.encode_values(buffer, metadata, values)
74
- Encoding.write_short(buffer, metadata.size)
74
+ buffer.append_short(metadata.size)
75
75
  metadata.each_with_index do |(_, _, _, type), index|
76
76
  TYPE_CONVERTER.to_bytes(buffer, type, values[index])
77
77
  end