cassandra-driver 3.0.0.beta.1-java → 3.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +106 -39
  3. data/lib/cassandra.rb +396 -148
  4. data/lib/cassandra/address_resolution.rb +1 -1
  5. data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +1 -1
  6. data/lib/cassandra/address_resolution/policies/none.rb +1 -1
  7. data/lib/cassandra/aggregate.rb +21 -7
  8. data/lib/cassandra/argument.rb +2 -2
  9. data/lib/cassandra/attr_boolean.rb +33 -0
  10. data/lib/cassandra/auth.rb +6 -5
  11. data/lib/cassandra/auth/providers.rb +1 -1
  12. data/lib/cassandra/auth/providers/password.rb +5 -13
  13. data/lib/cassandra/cassandra_logger.rb +80 -0
  14. data/lib/cassandra/cluster.rb +49 -9
  15. data/lib/cassandra/cluster/client.rb +835 -209
  16. data/lib/cassandra/cluster/connection_pool.rb +2 -2
  17. data/lib/cassandra/cluster/connector.rb +86 -27
  18. data/lib/cassandra/cluster/control_connection.rb +222 -95
  19. data/lib/cassandra/cluster/failed_connection.rb +1 -1
  20. data/lib/cassandra/cluster/metadata.rb +14 -8
  21. data/lib/cassandra/cluster/options.rb +68 -22
  22. data/lib/cassandra/cluster/registry.rb +81 -17
  23. data/lib/cassandra/cluster/schema.rb +70 -8
  24. data/lib/cassandra/cluster/schema/cql_type_parser.rb +15 -10
  25. data/lib/cassandra/cluster/schema/fetchers.rb +601 -241
  26. data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +39 -38
  27. data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
  28. data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +6 -8
  29. data/lib/cassandra/cluster/schema/partitioners/ordered.rb +1 -1
  30. data/lib/cassandra/cluster/schema/partitioners/random.rb +1 -1
  31. data/lib/cassandra/cluster/schema/replication_strategies.rb +1 -1
  32. data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +19 -18
  33. data/lib/cassandra/cluster/schema/replication_strategies/none.rb +1 -1
  34. data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +1 -1
  35. data/lib/cassandra/column.rb +4 -23
  36. data/lib/cassandra/column_container.rb +322 -0
  37. data/lib/cassandra/compression.rb +1 -1
  38. data/lib/cassandra/compression/compressors/lz4.rb +7 -8
  39. data/lib/cassandra/compression/compressors/snappy.rb +4 -3
  40. data/lib/cassandra/driver.rb +107 -46
  41. data/lib/cassandra/errors.rb +303 -52
  42. data/lib/cassandra/execution/info.rb +16 -5
  43. data/lib/cassandra/execution/options.rb +102 -55
  44. data/lib/cassandra/execution/trace.rb +16 -9
  45. data/lib/cassandra/executors.rb +1 -1
  46. data/lib/cassandra/function.rb +19 -13
  47. data/lib/cassandra/function_collection.rb +85 -0
  48. data/lib/cassandra/future.rb +101 -49
  49. data/lib/cassandra/host.rb +25 -5
  50. data/lib/cassandra/index.rb +118 -0
  51. data/lib/cassandra/keyspace.rb +169 -33
  52. data/lib/cassandra/listener.rb +1 -1
  53. data/lib/cassandra/load_balancing.rb +2 -2
  54. data/lib/cassandra/load_balancing/policies.rb +1 -1
  55. data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +39 -25
  56. data/lib/cassandra/load_balancing/policies/round_robin.rb +8 -1
  57. data/lib/cassandra/load_balancing/policies/token_aware.rb +22 -13
  58. data/lib/cassandra/load_balancing/policies/white_list.rb +18 -5
  59. data/lib/cassandra/materialized_view.rb +90 -0
  60. data/lib/cassandra/null_logger.rb +27 -6
  61. data/lib/cassandra/protocol.rb +1 -1
  62. data/lib/cassandra/protocol/coder.rb +81 -42
  63. data/lib/cassandra/protocol/cql_byte_buffer.rb +58 -44
  64. data/lib/cassandra/protocol/cql_protocol_handler.rb +57 -54
  65. data/lib/cassandra/protocol/request.rb +6 -7
  66. data/lib/cassandra/protocol/requests/auth_response_request.rb +3 -3
  67. data/lib/cassandra/protocol/requests/batch_request.rb +17 -8
  68. data/lib/cassandra/protocol/requests/credentials_request.rb +3 -3
  69. data/lib/cassandra/protocol/requests/execute_request.rb +39 -20
  70. data/lib/cassandra/protocol/requests/options_request.rb +1 -1
  71. data/lib/cassandra/protocol/requests/prepare_request.rb +5 -5
  72. data/lib/cassandra/protocol/requests/query_request.rb +28 -23
  73. data/lib/cassandra/protocol/requests/register_request.rb +2 -2
  74. data/lib/cassandra/protocol/requests/startup_request.rb +8 -8
  75. data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
  76. data/lib/cassandra/protocol/response.rb +3 -4
  77. data/lib/cassandra/protocol/responses/already_exists_error_response.rb +12 -2
  78. data/lib/cassandra/protocol/responses/auth_challenge_response.rb +4 -5
  79. data/lib/cassandra/protocol/responses/auth_success_response.rb +4 -5
  80. data/lib/cassandra/protocol/responses/authenticate_response.rb +4 -5
  81. data/lib/cassandra/protocol/responses/error_response.rb +104 -17
  82. data/lib/cassandra/protocol/responses/event_response.rb +3 -4
  83. data/lib/cassandra/protocol/responses/function_failure_error_response.rb +13 -2
  84. data/lib/cassandra/protocol/responses/prepared_result_response.rb +14 -9
  85. data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +14 -9
  86. data/lib/cassandra/protocol/responses/read_failure_error_response.rb +26 -4
  87. data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +22 -3
  88. data/lib/cassandra/protocol/responses/ready_response.rb +6 -7
  89. data/lib/cassandra/protocol/responses/result_response.rb +11 -10
  90. data/lib/cassandra/protocol/responses/rows_result_response.rb +8 -7
  91. data/lib/cassandra/protocol/responses/schema_change_event_response.rb +8 -8
  92. data/lib/cassandra/protocol/responses/schema_change_result_response.rb +19 -13
  93. data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +5 -6
  94. data/lib/cassandra/protocol/responses/status_change_event_response.rb +5 -6
  95. data/lib/cassandra/protocol/responses/supported_response.rb +4 -5
  96. data/lib/cassandra/protocol/responses/topology_change_event_response.rb +4 -5
  97. data/lib/cassandra/protocol/responses/unavailable_error_response.rb +20 -3
  98. data/lib/cassandra/protocol/responses/unprepared_error_response.rb +11 -2
  99. data/lib/cassandra/protocol/responses/void_result_response.rb +4 -5
  100. data/lib/cassandra/protocol/responses/write_failure_error_response.rb +26 -4
  101. data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +22 -3
  102. data/lib/cassandra/protocol/v1.rb +98 -37
  103. data/lib/cassandra/protocol/v3.rb +121 -50
  104. data/lib/cassandra/protocol/v4.rb +172 -68
  105. data/lib/cassandra/reconnection.rb +1 -1
  106. data/lib/cassandra/reconnection/policies.rb +1 -1
  107. data/lib/cassandra/reconnection/policies/constant.rb +2 -4
  108. data/lib/cassandra/reconnection/policies/exponential.rb +6 -6
  109. data/lib/cassandra/result.rb +55 -20
  110. data/lib/cassandra/retry.rb +8 -8
  111. data/lib/cassandra/retry/policies.rb +1 -1
  112. data/lib/cassandra/retry/policies/default.rb +1 -1
  113. data/lib/cassandra/retry/policies/downgrading_consistency.rb +4 -2
  114. data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
  115. data/lib/cassandra/session.rb +24 -16
  116. data/lib/cassandra/statement.rb +1 -1
  117. data/lib/cassandra/statements.rb +1 -1
  118. data/lib/cassandra/statements/batch.rb +16 -10
  119. data/lib/cassandra/statements/bound.rb +10 -3
  120. data/lib/cassandra/statements/prepared.rb +62 -18
  121. data/lib/cassandra/statements/simple.rb +23 -10
  122. data/lib/cassandra/statements/void.rb +1 -1
  123. data/lib/cassandra/table.rb +53 -185
  124. data/lib/cassandra/time.rb +11 -6
  125. data/lib/cassandra/time_uuid.rb +12 -14
  126. data/lib/cassandra/timestamp_generator.rb +37 -0
  127. data/lib/cassandra/timestamp_generator/simple.rb +38 -0
  128. data/lib/cassandra/timestamp_generator/ticking_on_duplicate.rb +58 -0
  129. data/lib/cassandra/tuple.rb +4 -4
  130. data/lib/cassandra/types.rb +109 -71
  131. data/lib/cassandra/udt.rb +66 -50
  132. data/lib/cassandra/util.rb +155 -15
  133. data/lib/cassandra/uuid.rb +20 -21
  134. data/lib/cassandra/uuid/generator.rb +7 -5
  135. data/lib/cassandra/version.rb +2 -2
  136. data/lib/cassandra_murmur3.jar +0 -0
  137. data/lib/datastax/cassandra.rb +1 -1
  138. metadata +27 -16
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -29,7 +29,17 @@ module Cassandra
29
29
  end
30
30
 
31
31
  def to_error(keyspace, statement, options, hosts, consistency, retries)
32
- Errors::AlreadyExistsError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries, @keyspace, @table)
32
+ Errors::AlreadyExistsError.new(@message,
33
+ @custom_payload,
34
+ @warnings,
35
+ keyspace,
36
+ statement,
37
+ options,
38
+ hosts,
39
+ consistency,
40
+ retries,
41
+ @keyspace,
42
+ @table)
33
43
  end
34
44
 
35
45
  def to_s
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,6 +19,9 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class AuthChallengeResponse < Response
22
+ # @private
23
+ RESPONSE_TYPES[0x0e] = self
24
+
22
25
  attr_reader :token
23
26
 
24
27
  def initialize(token)
@@ -28,10 +31,6 @@ module Cassandra
28
31
  def to_s
29
32
  %(AUTH_CHALLENGE #{@token.bytesize})
30
33
  end
31
-
32
- private
33
-
34
- RESPONSE_TYPES[0x0e] = self
35
34
  end
36
35
  end
37
36
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,6 +19,9 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class AuthSuccessResponse < Response
22
+ # @private
23
+ RESPONSE_TYPES[0x10] = self
24
+
22
25
  attr_reader :token
23
26
 
24
27
  def initialize(token)
@@ -28,10 +31,6 @@ module Cassandra
28
31
  def to_s
29
32
  %(AUTH_SUCCESS #{@token && @token.bytesize})
30
33
  end
31
-
32
- private
33
-
34
- RESPONSE_TYPES[0x10] = self
35
34
  end
36
35
  end
37
36
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,6 +19,9 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class AuthenticateResponse < Response
22
+ # @private
23
+ RESPONSE_TYPES[0x03] = self
24
+
22
25
  attr_reader :authentication_class
23
26
 
24
27
  def initialize(authentication_class)
@@ -28,10 +31,6 @@ module Cassandra
28
31
  def to_s
29
32
  %(AUTHENTICATE #{authentication_class})
30
33
  end
31
-
32
- private
33
-
34
- RESPONSE_TYPES[0x03] = self
35
34
  end
36
35
  end
37
36
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,6 +19,9 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class ErrorResponse < Response
22
+ # @private
23
+ RESPONSE_TYPES[0x00] = self
24
+
22
25
  attr_reader :code, :message, :custom_payload, :warnings
23
26
 
24
27
  def initialize(*args)
@@ -27,29 +30,113 @@ module Cassandra
27
30
 
28
31
  def to_s
29
32
  hex_code = @code.to_s(16).rjust(4, '0').upcase
30
- %(ERROR 0x#{hex_code} "#@message")
33
+ %(ERROR 0x#{hex_code} "#{@message}")
31
34
  end
32
35
 
33
36
  def to_error(keyspace, statement, options, hosts, consistency, retries)
34
37
  case @code
35
- when 0x0000 then Errors::ServerError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
36
- when 0x000A then Errors::ProtocolError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
37
- when 0x0100 then Errors::AuthenticationError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
38
- when 0x1001 then Errors::OverloadedError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
39
- when 0x1002 then Errors::IsBootstrappingError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
40
- when 0x1003 then Errors::TruncateError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
41
- when 0x2000 then Errors::SyntaxError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
42
- when 0x2100 then Errors::UnauthorizedError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
43
- when 0x2200 then Errors::InvalidError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
44
- when 0x2300 then Errors::ConfigurationError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
38
+ when 0x0000 then Errors::ServerError.new(@message,
39
+ @custom_payload,
40
+ @warnings,
41
+ keyspace,
42
+ statement,
43
+ options,
44
+ hosts,
45
+ consistency,
46
+ retries)
47
+ when 0x000A then Errors::ProtocolError.new(@message,
48
+ @custom_payload,
49
+ @warnings,
50
+ keyspace,
51
+ statement,
52
+ options,
53
+ hosts,
54
+ consistency,
55
+ retries)
56
+ when 0x0100 then Errors::AuthenticationError.new(@message,
57
+ @custom_payload,
58
+ @warnings,
59
+ keyspace,
60
+ statement,
61
+ options,
62
+ hosts,
63
+ consistency,
64
+ retries)
65
+ when 0x1001 then Errors::OverloadedError.new(@message,
66
+ @custom_payload,
67
+ @warnings,
68
+ keyspace,
69
+ statement,
70
+ options,
71
+ hosts,
72
+ consistency,
73
+ retries)
74
+ when 0x1002 then Errors::IsBootstrappingError.new(@message,
75
+ @custom_payload,
76
+ @warnings,
77
+ keyspace,
78
+ statement,
79
+ options,
80
+ hosts,
81
+ consistency,
82
+ retries)
83
+ when 0x1003 then Errors::TruncateError.new(@message,
84
+ @custom_payload,
85
+ @warnings,
86
+ keyspace,
87
+ statement,
88
+ options,
89
+ hosts,
90
+ consistency,
91
+ retries)
92
+ when 0x2000 then Errors::SyntaxError.new(@message,
93
+ @custom_payload,
94
+ @warnings,
95
+ keyspace,
96
+ statement,
97
+ options,
98
+ hosts,
99
+ consistency,
100
+ retries)
101
+ when 0x2100 then Errors::UnauthorizedError.new(@message,
102
+ @custom_payload,
103
+ @warnings,
104
+ keyspace,
105
+ statement,
106
+ options,
107
+ hosts,
108
+ consistency,
109
+ retries)
110
+ when 0x2200 then Errors::InvalidError.new(@message,
111
+ @custom_payload,
112
+ @warnings,
113
+ keyspace,
114
+ statement,
115
+ options,
116
+ hosts,
117
+ consistency,
118
+ retries)
119
+ when 0x2300 then Errors::ConfigurationError.new(@message,
120
+ @custom_payload,
121
+ @warnings,
122
+ keyspace,
123
+ statement,
124
+ options,
125
+ hosts,
126
+ consistency,
127
+ retries)
45
128
  else
46
- Errors::ServerError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries)
129
+ Errors::ServerError.new(@message,
130
+ @custom_payload,
131
+ @warnings,
132
+ keyspace,
133
+ statement,
134
+ options,
135
+ hosts,
136
+ consistency,
137
+ retries)
47
138
  end
48
139
  end
49
-
50
- private
51
-
52
- RESPONSE_TYPES[0x00] = self
53
140
  end
54
141
  end
55
142
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,10 +19,9 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class EventResponse < ResultResponse
22
- private
23
-
22
+ # @private
24
23
  RESPONSE_TYPES[0x0c] = self
25
-
24
+ # @private
26
25
  EVENT_TYPES = {
27
26
  # populated by subclasses
28
27
  }
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -30,7 +30,18 @@ module Cassandra
30
30
  end
31
31
 
32
32
  def to_error(keyspace, statement, options, hosts, consistency, retries)
33
- Errors::FunctionCallError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries, @keyspace, @name, @signature)
33
+ Errors::FunctionCallError.new(@message,
34
+ @custom_payload,
35
+ @warnings,
36
+ keyspace,
37
+ statement,
38
+ options,
39
+ hosts,
40
+ consistency,
41
+ retries,
42
+ @keyspace,
43
+ @name,
44
+ @signature)
34
45
  end
35
46
 
36
47
  def to_s
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,9 +19,18 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class PreparedResultResponse < ResultResponse
22
+ # @private
23
+ RESULT_TYPES[0x04] = self
24
+
22
25
  attr_reader :id, :metadata, :result_metadata, :pk_idx
23
26
 
24
- def initialize(custom_payload, warnings, id, metadata, result_metadata, pk_idx, trace_id)
27
+ def initialize(custom_payload,
28
+ warnings,
29
+ id,
30
+ metadata,
31
+ result_metadata,
32
+ pk_idx,
33
+ trace_id)
25
34
  super(custom_payload, warnings, trace_id)
26
35
  @id = id
27
36
  @metadata = metadata
@@ -30,9 +39,9 @@ module Cassandra
30
39
  end
31
40
 
32
41
  def eql?(other)
33
- self.id == other.id && self.metadata == other.metadata && self.trace_id == other.trace_id
42
+ id == other.id && metadata == other.metadata && trace_id == other.trace_id
34
43
  end
35
- alias_method :==, :eql?
44
+ alias == eql?
36
45
 
37
46
  def hash
38
47
  @h ||= begin
@@ -46,12 +55,8 @@ module Cassandra
46
55
 
47
56
  def to_s
48
57
  hex_id = @id.each_byte.map { |x| x.to_s(16).rjust(2, '0') }.join('')
49
- %(RESULT PREPARED #{hex_id} #@metadata)
58
+ %(RESULT PREPARED #{hex_id} #{@metadata})
50
59
  end
51
-
52
- private
53
-
54
- RESULT_TYPES[0x04] = self
55
60
  end
56
61
  end
57
62
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -19,7 +19,12 @@
19
19
  module Cassandra
20
20
  module Protocol
21
21
  class RawRowsResultResponse < RowsResultResponse
22
- def initialize(custom_payload, warnings, protocol_version, raw_rows, paging_state, trace_id)
22
+ def initialize(custom_payload,
23
+ warnings,
24
+ protocol_version,
25
+ raw_rows,
26
+ paging_state,
27
+ trace_id)
23
28
  super(custom_payload, warnings, nil, nil, paging_state, trace_id)
24
29
  @protocol_version = protocol_version
25
30
  @raw_rows = raw_rows
@@ -28,13 +33,13 @@ module Cassandra
28
33
  def materialize(metadata)
29
34
  @metadata = metadata
30
35
 
31
- if @protocol_version == 4
32
- @rows = Coder.read_values_v4(@raw_rows, @metadata)
33
- elsif @protocol_version == 3
34
- @rows = Coder.read_values_v3(@raw_rows, @metadata)
35
- else
36
- @rows = Coder.read_values_v1(@raw_rows, @metadata)
37
- end
36
+ @rows = if @protocol_version == 4
37
+ Coder.read_values_v4(@raw_rows, @metadata)
38
+ elsif @protocol_version == 3
39
+ Coder.read_values_v3(@raw_rows, @metadata)
40
+ else
41
+ Coder.read_values_v1(@raw_rows, @metadata)
42
+ end
38
43
 
39
44
  @rows
40
45
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  #--
4
- # Copyright 2013-2015 DataStax, Inc.
4
+ # Copyright 2013-2016 DataStax, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -21,7 +21,15 @@ module Cassandra
21
21
  class ReadFailureErrorResponse < ErrorResponse
22
22
  attr_reader :consistency, :received, :blockfor, :numfailures, :data_present
23
23
 
24
- def initialize(custom_payload, warnings, code, message, consistency, received, blockfor, numfailures, data_present)
24
+ def initialize(custom_payload,
25
+ warnings,
26
+ code,
27
+ message,
28
+ consistency,
29
+ received,
30
+ blockfor,
31
+ numfailures,
32
+ data_present)
25
33
  super(custom_payload, warnings, code, message)
26
34
 
27
35
  @consistency = consistency
@@ -32,11 +40,25 @@ module Cassandra
32
40
  end
33
41
 
34
42
  def to_error(keyspace, statement, options, hosts, consistency, retries)
35
- Errors::ReadError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries, @data_present, @consistency, @blockfor, @numfailures, @received)
43
+ Errors::ReadError.new(@message,
44
+ @custom_payload,
45
+ @warnings,
46
+ keyspace,
47
+ statement,
48
+ options,
49
+ hosts,
50
+ consistency,
51
+ retries,
52
+ @data_present,
53
+ @consistency,
54
+ @blockfor,
55
+ @numfailures,
56
+ @received)
36
57
  end
37
58
 
38
59
  def to_s
39
- "#{super} #{@consistency} #{@received} #{@blockfor} #{@numfailures} #{@data_present}"
60
+ "#{super} #{@consistency} #{@received} #{@blockfor} #{@numfailures} " \
61
+ "#{@data_present}"
40
62
  end
41
63
  end
42
64
  end