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
@@ -11,8 +11,8 @@ module Cql
11
11
  false
12
12
  end
13
13
 
14
- def write(protocol_version, io)
15
- io
14
+ def write(protocol_version, buffer)
15
+ buffer
16
16
  end
17
17
 
18
18
  def to_s
@@ -11,8 +11,8 @@ module Cql
11
11
  @cql = cql
12
12
  end
13
13
 
14
- def write(protocol_version, io)
15
- write_long_string(io, @cql)
14
+ def write(protocol_version, buffer)
15
+ buffer.append_long_string(@cql)
16
16
  end
17
17
 
18
18
  def to_s
@@ -15,16 +15,16 @@ module Cql
15
15
  @cql = cql
16
16
  @values = values || EMPTY_LIST
17
17
  @type_hints = type_hints || EMPTY_LIST
18
- @encoded_values = self.class.encode_values('', @values, @type_hints)
18
+ @encoded_values = self.class.encode_values(CqlByteBuffer.new, @values, @type_hints)
19
19
  @consistency = consistency
20
20
  @serial_consistency = serial_consistency
21
21
  @page_size = page_size
22
22
  @paging_state = paging_state
23
23
  end
24
24
 
25
- def write(protocol_version, io)
26
- write_long_string(io, @cql)
27
- write_consistency(io, @consistency)
25
+ def write(protocol_version, buffer)
26
+ buffer.append_long_string(@cql)
27
+ buffer.append_consistency(@consistency)
28
28
  if protocol_version > 1
29
29
  flags = 0
30
30
  flags |= 0x04 if @page_size
@@ -32,16 +32,16 @@ module Cql
32
32
  flags |= 0x10 if @serial_consistency
33
33
  if @values && @values.size > 0
34
34
  flags |= 0x01
35
- io << flags.chr
36
- io << @encoded_values
35
+ buffer.append(flags.chr)
36
+ buffer.append(@encoded_values)
37
37
  else
38
- io << flags.chr
38
+ buffer.append(flags.chr)
39
39
  end
40
- write_int(io, @page_size) if @page_size
41
- write_bytes(io, @paging_state) if @paging_state
42
- write_consistency(io, @serial_consistency) if @serial_consistency
40
+ buffer.append_int(@page_size) if @page_size
41
+ buffer.append_bytes(@paging_state) if @paging_state
42
+ buffer.append_consistency(@serial_consistency) if @serial_consistency
43
43
  end
44
- io
44
+ buffer
45
45
  end
46
46
 
47
47
  def to_s
@@ -74,7 +74,7 @@ module Cql
74
74
 
75
75
  def self.encode_values(buffer, values, hints)
76
76
  if values && values.size > 0
77
- Encoding.write_short(buffer, values.size)
77
+ buffer.append_short(values.size)
78
78
  values.each_with_index do |value, index|
79
79
  type = (hints && hints[index]) || guess_type(value)
80
80
  raise EncodingError, "Could not guess a suitable type for #{value.inspect}" unless type
@@ -82,7 +82,7 @@ module Cql
82
82
  end
83
83
  buffer
84
84
  else
85
- Encoding.write_short(buffer, 0)
85
+ buffer.append_short(0)
86
86
  end
87
87
  end
88
88
 
@@ -10,8 +10,8 @@ module Cql
10
10
  @events = events
11
11
  end
12
12
 
13
- def write(protocol_version, io)
14
- write_string_list(io, @events)
13
+ def write(protocol_version, buffer)
14
+ buffer.append_string_list(@events)
15
15
  end
16
16
 
17
17
  def to_s
@@ -16,8 +16,8 @@ module Cql
16
16
  false
17
17
  end
18
18
 
19
- def write(protocol_version, io)
20
- write_string_map(io, @options)
19
+ def write(protocol_version, buffer)
20
+ buffer.append_string_map(@options)
21
21
  end
22
22
 
23
23
  def to_s
@@ -3,12 +3,10 @@
3
3
  module Cql
4
4
  module Protocol
5
5
  class Response
6
- extend Decoding
7
-
8
- def self.decode!(opcode, protocol_version, buffer, length, trace_id)
6
+ def self.decode(opcode, protocol_version, buffer, length, trace_id)
9
7
  response_class = RESPONSE_TYPES[opcode]
10
8
  if response_class
11
- response_class.decode!(protocol_version, buffer, length, trace_id)
9
+ response_class.decode(protocol_version, buffer, length, trace_id)
12
10
  else
13
11
  raise UnsupportedOperationError, "The operation #{opcode} is not supported"
14
12
  end
@@ -5,8 +5,8 @@ module Cql
5
5
  class AuthChallengeResponse < Response
6
6
  attr_reader :token
7
7
 
8
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
9
- new(read_bytes!(buffer))
8
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
9
+ new(buffer.read_bytes)
10
10
  end
11
11
 
12
12
  def initialize(token)
@@ -5,8 +5,8 @@ module Cql
5
5
  class AuthSuccessResponse < Response
6
6
  attr_reader :token
7
7
 
8
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
9
- new(read_bytes!(buffer))
8
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
9
+ new(buffer.read_bytes)
10
10
  end
11
11
 
12
12
  def initialize(token)
@@ -5,8 +5,8 @@ module Cql
5
5
  class AuthenticateResponse < Response
6
6
  attr_reader :authentication_class
7
7
 
8
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
9
- new(read_string!(buffer))
8
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
9
+ new(buffer.read_string)
10
10
  end
11
11
 
12
12
  def initialize(authentication_class)
@@ -10,28 +10,28 @@ module Cql
10
10
  @details = details
11
11
  end
12
12
 
13
- def self.decode!(code, message, protocol_version, buffer, length, trace_id=nil)
13
+ def self.decode(code, message, protocol_version, buffer, length, trace_id=nil)
14
14
  details = {}
15
15
  case code
16
16
  when 0x1000 # unavailable
17
- details[:cl] = read_consistency!(buffer)
18
- details[:required] = read_int!(buffer)
19
- details[:alive] = read_int!(buffer)
17
+ details[:cl] = buffer.read_consistency
18
+ details[:required] = buffer.read_int
19
+ details[:alive] = buffer.read_int
20
20
  when 0x1100 # write_timeout
21
- details[:cl] = read_consistency!(buffer)
22
- details[:received] = read_int!(buffer)
23
- details[:blockfor] = read_int!(buffer)
24
- details[:write_type] = read_string!(buffer)
21
+ details[:cl] = buffer.read_consistency
22
+ details[:received] = buffer.read_int
23
+ details[:blockfor] = buffer.read_int
24
+ details[:write_type] = buffer.read_string
25
25
  when 0x1200 # read_timeout
26
- details[:cl] = read_consistency!(buffer)
27
- details[:received] = read_int!(buffer)
28
- details[:blockfor] = read_int!(buffer)
29
- details[:data_present] = read_byte!(buffer) != 0
26
+ details[:cl] = buffer.read_consistency
27
+ details[:received] = buffer.read_int
28
+ details[:blockfor] = buffer.read_int
29
+ details[:data_present] = buffer.read_byte != 0
30
30
  when 0x2400 # already_exists
31
- details[:ks] = read_string!(buffer)
32
- details[:table] = read_string!(buffer)
31
+ details[:ks] = buffer.read_string
32
+ details[:table] = buffer.read_string
33
33
  when 0x2500
34
- details[:id] = read_short_bytes!(buffer)
34
+ details[:id] = buffer.read_short_bytes
35
35
  end
36
36
  new(code, message, details)
37
37
  end
@@ -9,13 +9,13 @@ module Cql
9
9
  @code, @message = args
10
10
  end
11
11
 
12
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
13
- code = read_int!(buffer)
14
- message = read_string!(buffer)
12
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
13
+ code = buffer.read_int
14
+ message = buffer.read_string
15
15
  case code
16
16
  when 0x1000, 0x1100, 0x1200, 0x2400, 0x2500
17
17
  new_length = length - 4 - 4 - message.bytesize
18
- DetailedErrorResponse.decode!(code, message, protocol_version, buffer, new_length)
18
+ DetailedErrorResponse.decode(code, message, protocol_version, buffer, new_length)
19
19
  else
20
20
  new(code, message)
21
21
  end
@@ -3,12 +3,12 @@
3
3
  module Cql
4
4
  module Protocol
5
5
  class EventResponse < ResultResponse
6
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
7
- type = read_string!(buffer)
6
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
7
+ type = buffer.read_string
8
8
  impl = EVENT_TYPES[type]
9
9
  raise UnsupportedEventTypeError, %(Unsupported event type: "#{type}") unless impl
10
10
  new_length = length - 4 - type.bytesize
11
- impl.decode!(protocol_version, buffer, new_length, trace_id)
11
+ impl.decode(protocol_version, buffer, new_length, trace_id)
12
12
  end
13
13
 
14
14
  private
@@ -10,12 +10,12 @@ module Cql
10
10
  @id, @metadata, @result_metadata = id, metadata, result_metadata
11
11
  end
12
12
 
13
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
14
- id = read_short_bytes!(buffer)
15
- metadata, _ = RowsResultResponse.read_metadata!(protocol_version, buffer)
13
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
14
+ id = buffer.read_short_bytes
15
+ metadata, _ = RowsResultResponse.read_metadata(protocol_version, buffer)
16
16
  result_metadata = nil
17
17
  if protocol_version > 1
18
- result_metadata, _, _ = RowsResultResponse.read_metadata!(protocol_version, buffer)
18
+ result_metadata, _, _ = RowsResultResponse.read_metadata(protocol_version, buffer)
19
19
  end
20
20
  new(id, metadata, result_metadata, trace_id)
21
21
  end
@@ -11,7 +11,7 @@ module Cql
11
11
 
12
12
  def materialize(metadata)
13
13
  @metadata = metadata
14
- @rows = RowsResultResponse.read_rows!(@protocol_version, @raw_rows, @metadata)
14
+ @rows = RowsResultResponse.read_rows(@protocol_version, @raw_rows, @metadata)
15
15
  end
16
16
 
17
17
  def rows
@@ -3,7 +3,7 @@
3
3
  module Cql
4
4
  module Protocol
5
5
  class ReadyResponse < Response
6
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
6
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
7
7
  new
8
8
  end
9
9
 
@@ -9,11 +9,11 @@ module Cql
9
9
  @trace_id = trace_id
10
10
  end
11
11
 
12
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
13
- kind = read_int!(buffer)
12
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
13
+ kind = buffer.read_int
14
14
  impl = RESULT_TYPES[kind]
15
15
  raise UnsupportedResultKindError, %(Unsupported result kind: #{kind}) unless impl
16
- impl.decode!(protocol_version, buffer, length - 4, trace_id)
16
+ impl.decode(protocol_version, buffer, length - 4, trace_id)
17
17
  end
18
18
 
19
19
  def void?
@@ -10,15 +10,15 @@ module Cql
10
10
  @rows, @metadata, @paging_state = rows, metadata, paging_state
11
11
  end
12
12
 
13
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
13
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
14
14
  original_buffer_length = buffer.length
15
- column_specs, columns_count, paging_state = read_metadata!(protocol_version, buffer)
15
+ column_specs, columns_count, paging_state = read_metadata(protocol_version, buffer)
16
16
  if column_specs.nil?
17
17
  consumed_bytes = original_buffer_length - buffer.length
18
- remaining_bytes = ByteBuffer.new(buffer.read(length - consumed_bytes))
18
+ remaining_bytes = CqlByteBuffer.new(buffer.read(length - consumed_bytes))
19
19
  RawRowsResultResponse.new(protocol_version, remaining_bytes, paging_state, trace_id)
20
20
  else
21
- new(read_rows!(protocol_version, buffer, column_specs), column_specs, paging_state, trace_id)
21
+ new(read_rows(protocol_version, buffer, column_specs), column_specs, paging_state, trace_id)
22
22
  end
23
23
  end
24
24
 
@@ -56,19 +56,19 @@ module Cql
56
56
  HAS_MORE_PAGES_FLAG = 0x02
57
57
  NO_METADATA_FLAG = 0x04
58
58
 
59
- def self.read_column_type!(buffer)
60
- id, type = read_option!(buffer) do |id, b|
59
+ def self.read_column_type(buffer)
60
+ id, type = buffer.read_option do |id, b|
61
61
  if id > 0 && id <= 0x10
62
62
  COLUMN_TYPES[id]
63
63
  elsif id == 0x20
64
- sub_type = read_column_type!(buffer)
64
+ sub_type = read_column_type(buffer)
65
65
  [:list, sub_type]
66
66
  elsif id == 0x21
67
- key_type = read_column_type!(buffer)
68
- value_type = read_column_type!(buffer)
67
+ key_type = read_column_type(buffer)
68
+ value_type = read_column_type(buffer)
69
69
  [:map, key_type, value_type]
70
70
  elsif id == 0x22
71
- sub_type = read_column_type!(buffer)
71
+ sub_type = read_column_type(buffer)
72
72
  [:set, sub_type]
73
73
  else
74
74
  raise UnsupportedColumnTypeError, %(Unsupported column type: #{id})
@@ -77,37 +77,37 @@ module Cql
77
77
  type
78
78
  end
79
79
 
80
- def self.read_metadata!(protocol_version, buffer)
81
- flags = read_int!(buffer)
82
- columns_count = read_int!(buffer)
80
+ def self.read_metadata(protocol_version, buffer)
81
+ flags = buffer.read_int
82
+ columns_count = buffer.read_int
83
83
  paging_state = nil
84
84
  column_specs = nil
85
85
  if flags & HAS_MORE_PAGES_FLAG != 0
86
- paging_state = read_bytes!(buffer)
86
+ paging_state = buffer.read_bytes
87
87
  end
88
88
  if flags & NO_METADATA_FLAG == 0
89
89
  if flags & GLOBAL_TABLES_SPEC_FLAG != 0
90
- global_keyspace_name = read_string!(buffer)
91
- global_table_name = read_string!(buffer)
90
+ global_keyspace_name = buffer.read_string
91
+ global_table_name = buffer.read_string
92
92
  end
93
93
  column_specs = columns_count.times.map do
94
94
  if global_keyspace_name
95
95
  keyspace_name = global_keyspace_name
96
96
  table_name = global_table_name
97
97
  else
98
- keyspace_name = read_string!(buffer)
99
- table_name = read_string!(buffer)
98
+ keyspace_name = buffer.read_string
99
+ table_name = buffer.read_string
100
100
  end
101
- column_name = read_string!(buffer)
102
- type = read_column_type!(buffer)
101
+ column_name = buffer.read_string
102
+ type = read_column_type(buffer)
103
103
  [keyspace_name, table_name, column_name, type]
104
104
  end
105
105
  end
106
106
  [column_specs, columns_count, paging_state]
107
107
  end
108
108
 
109
- def self.read_rows!(protocol_version, buffer, column_specs)
110
- rows_count = read_int!(buffer)
109
+ def self.read_rows(protocol_version, buffer, column_specs)
110
+ rows_count = buffer.read_int
111
111
  rows = []
112
112
  rows_count.times do |row_index|
113
113
  row = {}
@@ -12,8 +12,8 @@ module Cql
12
12
  @type = TYPE
13
13
  end
14
14
 
15
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
16
- new(read_string!(buffer), read_string!(buffer), read_string!(buffer))
15
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
16
+ new(buffer.read_string, buffer.read_string, buffer.read_string)
17
17
  end
18
18
 
19
19
  def eql?(rs)
@@ -10,8 +10,8 @@ module Cql
10
10
  @change, @keyspace, @table = change, keyspace, table
11
11
  end
12
12
 
13
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
14
- new(read_string!(buffer), read_string!(buffer), read_string!(buffer), trace_id)
13
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
14
+ new(buffer.read_string, buffer.read_string, buffer.read_string, trace_id)
15
15
  end
16
16
 
17
17
  def eql?(other)
@@ -10,8 +10,8 @@ module Cql
10
10
  @keyspace = keyspace
11
11
  end
12
12
 
13
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
14
- new(read_string!(buffer), trace_id)
13
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
14
+ new(buffer.read_string, trace_id)
15
15
  end
16
16
 
17
17
  def to_s
@@ -12,8 +12,8 @@ module Cql
12
12
  @type = TYPE
13
13
  end
14
14
 
15
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
16
- new(read_string!(buffer), *read_inet!(buffer))
15
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
16
+ new(buffer.read_string, *buffer.read_inet)
17
17
  end
18
18
 
19
19
  def to_s
@@ -9,8 +9,8 @@ module Cql
9
9
  @options = options
10
10
  end
11
11
 
12
- def self.decode!(protocol_version, buffer, length, trace_id=nil)
13
- new(read_string_multimap!(buffer))
12
+ def self.decode(protocol_version, buffer, length, trace_id=nil)
13
+ new(buffer.read_string_multimap)
14
14
  end
15
15
 
16
16
  def to_s