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.
@@ -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.
@@ -28,17 +28,21 @@ module Cassandra
28
28
  # :lz4` option when calling {Cassandra.cluster} and one will be created
29
29
  # automatically for you.
30
30
  class Lz4 < Compressor
31
+ # @private
32
+ BUFFER_FORMAT = 'Na*'.freeze
33
+
31
34
  # @return [String] `'lz4'`
32
35
  attr_reader :algorithm
33
36
 
34
37
  # @param [Integer] min_size (64) Don't compress frames smaller than
35
38
  # this size (see {#compress?}).
36
- def initialize(min_size=64)
39
+ def initialize(min_size = 64)
37
40
  unless defined?(::LZ4::Raw)
38
41
  begin
39
42
  require 'lz4-ruby'
40
43
  rescue LoadError => e
41
- raise LoadError, %[LZ4 support requires the "lz4-ruby" gem: #{e.message}], e.backtrace
44
+ raise LoadError, %(LZ4 support requires the "lz4-ruby" gem: #{e.message}),
45
+ e.backtrace
42
46
  end
43
47
  end
44
48
 
@@ -63,11 +67,6 @@ module Cassandra
63
67
  decompressed_size, compressed_data = str.to_s.unpack(BUFFER_FORMAT)
64
68
  ::LZ4::Raw.decompress(compressed_data, decompressed_size).first
65
69
  end
66
-
67
- private
68
-
69
- # @private
70
- BUFFER_FORMAT = 'Na*'.freeze
71
70
  end
72
71
  end
73
72
  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.
@@ -33,12 +33,13 @@ module Cassandra
33
33
 
34
34
  # @param [Integer] min_size (64) Don't compress frames smaller than
35
35
  # this size (see {#compress?}).
36
- def initialize(min_size=64)
36
+ def initialize(min_size = 64)
37
37
  unless defined?(::Snappy)
38
38
  begin
39
39
  require 'snappy'
40
40
  rescue LoadError => e
41
- raise LoadError, %[Snappy support requires the "snappy" gem: #{e.message}], e.backtrace
41
+ raise LoadError, %(Snappy support requires the "snappy" gem: #{e.message}),
42
+ e.backtrace
42
43
  end
43
44
  end
44
45
 
@@ -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.
@@ -20,28 +20,33 @@ module Cassandra
20
20
  # @private
21
21
  class Driver
22
22
  def self.let(name, &block)
23
- define_method(name) { @instances.has_key?(name) ? @instances[name] : @instances[name] = instance_eval(&block) }
23
+ define_method(name) do
24
+ @instances.key?(name) ?
25
+ @instances[name] :
26
+ @instances[name] = instance_eval(&block)
27
+ end
24
28
  define_method(:"#{name}=") { |object| @instances[name] = object }
25
29
  end
26
30
 
27
31
  let(:io_reactor) { Ione::Io::IoReactor.new }
28
32
  let(:cluster_registry) { Cluster::Registry.new(logger) }
29
33
  let(:cluster_schema) { Cluster::Schema.new }
30
- let(:cluster_metadata) { Cluster::Metadata.new(
31
- cluster_registry,
32
- cluster_schema,
33
- {
34
- 'org.apache.cassandra.dht.Murmur3Partitioner' => murmur3_partitioner,
35
- 'org.apache.cassandra.dht.ByteOrderedPartitioner' => ordered_partitioner,
36
- 'org.apache.cassandra.dht.RandomPartitioner' => random_partitioner
37
- }.freeze,
38
- {
39
- 'SimpleStrategy' => simple_replication_strategy,
40
- 'NetworkTopologyStrategy' => network_topology_replication_strategy
41
- }.freeze,
42
- no_replication_strategy
43
- )
44
- }
34
+ let(:cluster_metadata) do
35
+ Cluster::Metadata.new(
36
+ cluster_registry,
37
+ cluster_schema,
38
+ {
39
+ 'org.apache.cassandra.dht.Murmur3Partitioner' => murmur3_partitioner,
40
+ 'org.apache.cassandra.dht.ByteOrderedPartitioner' => ordered_partitioner,
41
+ 'org.apache.cassandra.dht.RandomPartitioner' => random_partitioner
42
+ }.freeze,
43
+ {
44
+ 'SimpleStrategy' => simple_replication_strategy,
45
+ 'NetworkTopologyStrategy' => network_topology_replication_strategy
46
+ }.freeze,
47
+ no_replication_strategy
48
+ )
49
+ end
45
50
 
46
51
  let(:executor) { Executors::ThreadPool.new(thread_pool_size) }
47
52
  let(:futures_factory) { Future::Factory.new(executor) }
@@ -49,34 +54,74 @@ module Cassandra
49
54
  let(:schema_fqcn_type_parser) { Cluster::Schema::FQCNTypeParser.new }
50
55
  let(:schema_cql_type_parser) { Cluster::Schema::CQLTypeParser.new }
51
56
 
52
- let(:simple_replication_strategy) { Cluster::Schema::ReplicationStrategies::Simple.new }
53
- let(:network_topology_replication_strategy) { Cluster::Schema::ReplicationStrategies::NetworkTopology.new }
54
- let(:no_replication_strategy) { Cluster::Schema::ReplicationStrategies::None.new }
57
+ let(:simple_replication_strategy) do
58
+ Cluster::Schema::ReplicationStrategies::Simple.new
59
+ end
60
+ let(:network_topology_replication_strategy) do
61
+ Cluster::Schema::ReplicationStrategies::NetworkTopology.new
62
+ end
63
+ let(:no_replication_strategy) do
64
+ Cluster::Schema::ReplicationStrategies::None.new
65
+ end
55
66
 
56
67
  let(:murmur3_partitioner) { Cluster::Schema::Partitioners::Murmur3.new }
57
68
  let(:ordered_partitioner) { Cluster::Schema::Partitioners::Ordered.new }
58
69
  let(:random_partitioner) { Cluster::Schema::Partitioners::Random.new }
59
70
 
60
- let(:connector) { Cluster::Connector.new(logger, io_reactor, cluster_registry, connection_options, execution_options) }
71
+ let(:connector) do
72
+ Cluster::Connector.new(logger,
73
+ io_reactor,
74
+ cluster_registry,
75
+ connection_options,
76
+ execution_options)
77
+ end
61
78
 
62
79
  let(:schema_fetcher) { create_schema_fetcher_picker }
63
80
 
64
- let(:control_connection) { Cluster::ControlConnection.new(logger, io_reactor, cluster_registry, cluster_schema, cluster_metadata, load_balancing_policy, reconnection_policy, address_resolution_policy, connector, connection_options, schema_fetcher) }
81
+ let(:control_connection) do
82
+ Cluster::ControlConnection.new(logger,
83
+ io_reactor,
84
+ cluster_registry,
85
+ cluster_schema,
86
+ cluster_metadata,
87
+ load_balancing_policy,
88
+ reconnection_policy,
89
+ address_resolution_policy,
90
+ connector,
91
+ connection_options,
92
+ schema_fetcher)
93
+ end
65
94
 
66
- let(:cluster) { Cluster.new(logger, io_reactor, executor, control_connection, cluster_registry, cluster_schema, cluster_metadata, execution_options, connection_options, load_balancing_policy, reconnection_policy, retry_policy, address_resolution_policy, connector, futures_factory) }
95
+ let(:cluster) do
96
+ Cluster.new(logger,
97
+ io_reactor,
98
+ executor,
99
+ control_connection,
100
+ cluster_registry,
101
+ cluster_schema,
102
+ cluster_metadata,
103
+ execution_options,
104
+ connection_options,
105
+ load_balancing_policy,
106
+ reconnection_policy,
107
+ retry_policy,
108
+ address_resolution_policy,
109
+ connector,
110
+ futures_factory,
111
+ timestamp_generator)
112
+ end
67
113
 
68
114
  let(:execution_options) do
69
- Execution::Options.new({
70
- :consistency => consistency,
71
- :trace => trace,
72
- :page_size => page_size,
73
- :timeout => timeout,
74
- :idempotent => false
75
- })
115
+ Execution::Options.new(consistency: consistency,
116
+ trace: trace,
117
+ page_size: page_size,
118
+ timeout: timeout,
119
+ idempotent: false)
76
120
  end
77
121
 
78
122
  let(:connection_options) do
79
123
  Cluster::Options.new(
124
+ logger,
80
125
  protocol_version,
81
126
  credentials,
82
127
  auth_provider,
@@ -91,22 +136,28 @@ module Cassandra
91
136
  synchronize_schema,
92
137
  schema_refresh_delay,
93
138
  schema_refresh_timeout,
94
- client_timestamps,
95
- nodelay
139
+ nodelay,
140
+ requests_per_connection
96
141
  )
97
142
  end
98
143
 
99
144
  let(:port) { 9042 }
100
- let(:protocol_version) { 4 }
145
+ let(:protocol_version) { nil }
101
146
  let(:connect_timeout) { 10 }
102
147
  let(:ssl) { false }
103
- let(:logger) { NullLogger.new }
148
+ let(:logger) { NullLogger.new }
104
149
  let(:compressor) { nil }
105
150
  let(:credentials) { nil }
106
151
  let(:auth_provider) { nil }
107
152
  let(:datacenter) { nil }
108
- let(:load_balancing_policy) { LoadBalancing::Policies::TokenAware.new(LoadBalancing::Policies::DCAwareRoundRobin.new(datacenter, 0), shuffle_replicas) }
109
- let(:reconnection_policy) { Reconnection::Policies::Exponential.new(0.5, 30, 2) }
153
+ let(:load_balancing_policy) do
154
+ LoadBalancing::Policies::TokenAware.new(
155
+ LoadBalancing::Policies::DCAwareRoundRobin.new(datacenter, 0),
156
+ shuffle_replicas)
157
+ end
158
+ let(:reconnection_policy) do
159
+ Reconnection::Policies::Exponential.new(0.5, 30, 2)
160
+ end
110
161
  let(:retry_policy) { Retry::Policies::Default.new }
111
162
  let(:address_resolution_policy) { AddressResolution::Policies::None.new }
112
163
  let(:consistency) { :local_one }
@@ -114,17 +165,17 @@ module Cassandra
114
165
  let(:page_size) { 10000 }
115
166
  let(:heartbeat_interval) { 30 }
116
167
  let(:idle_timeout) { 60 }
117
- let(:timeout) { 10 }
168
+ let(:timeout) { 12 }
118
169
  let(:synchronize_schema) { true }
119
170
  let(:schema_refresh_delay) { 1 }
120
171
  let(:schema_refresh_timeout) { 10 }
121
172
  let(:thread_pool_size) { 4 }
122
173
  let(:shuffle_replicas) { true }
123
- let(:client_timestamps) { false }
124
174
  let(:nodelay) { true }
125
-
126
- let(:connections_per_local_node) { 2 }
127
- let(:connections_per_remote_node) { 1 }
175
+ let(:timestamp_generator) { nil }
176
+ let(:connections_per_local_node) { nil }
177
+ let(:connections_per_remote_node) { nil }
178
+ let(:requests_per_connection) { nil }
128
179
 
129
180
  let(:listeners) { [] }
130
181
 
@@ -166,11 +217,21 @@ module Cassandra
166
217
  def create_schema_fetcher_picker
167
218
  picker = Cluster::Schema::Fetchers::MultiVersion.new(cluster_registry)
168
219
 
169
- picker.when('1.2') { Cluster::Schema::Fetchers::V1_2_x.new(schema_fqcn_type_parser, cluster_schema) }
170
- picker.when('2.0') { Cluster::Schema::Fetchers::V2_0_x.new(schema_fqcn_type_parser, cluster_schema) }
171
- picker.when('2.1') { Cluster::Schema::Fetchers::V2_1_x.new(schema_fqcn_type_parser, cluster_schema) }
172
- picker.when('2.2') { Cluster::Schema::Fetchers::V2_2_x.new(schema_fqcn_type_parser, cluster_schema) }
173
- picker.when('3.0') { Cluster::Schema::Fetchers::V3_0_x.new(schema_cql_type_parser, cluster_schema) }
220
+ picker.when('1.2') do
221
+ Cluster::Schema::Fetchers::V1_2_x.new(schema_fqcn_type_parser, cluster_schema)
222
+ end
223
+ picker.when('2.0') do
224
+ Cluster::Schema::Fetchers::V2_0_x.new(schema_fqcn_type_parser, cluster_schema)
225
+ end
226
+ picker.when('2.1') do
227
+ Cluster::Schema::Fetchers::V2_1_x.new(schema_fqcn_type_parser, cluster_schema)
228
+ end
229
+ picker.when('2.2') do
230
+ Cluster::Schema::Fetchers::V2_2_x.new(schema_fqcn_type_parser, cluster_schema)
231
+ end
232
+ picker.when('3.') do
233
+ Cluster::Schema::Fetchers::V3_0_x.new(schema_cql_type_parser, cluster_schema)
234
+ end
174
235
 
175
236
  picker
176
237
  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.
@@ -43,12 +43,21 @@ module Cassandra
43
43
  # Raised when something unexpected happened. This indicates a server-side
44
44
  # bug.
45
45
  #
46
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L654-L655 Description of Server Error in Apache Cassandra native protocol spec v1
46
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L654-L655 Description
47
+ # of Server Error in Apache Cassandra native protocol spec v1
47
48
  class ServerError < ::StandardError
48
49
  include Error, HostError
49
50
 
50
51
  # @private
51
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
52
+ def initialize(message,
53
+ payload,
54
+ warnings,
55
+ keyspace,
56
+ statement,
57
+ options,
58
+ hosts,
59
+ consistency,
60
+ retries)
52
61
  super(message)
53
62
  @payload = payload
54
63
  @warnings = warnings
@@ -63,7 +72,15 @@ module Cassandra
63
72
  # Query execution information, such as number of retries and all tried hosts, etc.
64
73
  # @return [Cassandra::Execution::Info]
65
74
  def execution_info
66
- @info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
75
+ @info ||= Execution::Info.new(@payload,
76
+ @warnings,
77
+ @keyspace,
78
+ @statement,
79
+ @options,
80
+ @hosts,
81
+ @consistency,
82
+ @retries,
83
+ nil)
67
84
  end
68
85
  end
69
86
 
@@ -97,7 +114,15 @@ module Cassandra
97
114
  include Error
98
115
 
99
116
  # @private
100
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
117
+ def initialize(message,
118
+ payload,
119
+ warnings,
120
+ keyspace,
121
+ statement,
122
+ options,
123
+ hosts,
124
+ consistency,
125
+ retries)
101
126
  super(message)
102
127
  @payload = payload
103
128
  @warnings = warnings
@@ -112,7 +137,15 @@ module Cassandra
112
137
  # Query execution information, such as number of retries and all tried hosts, etc.
113
138
  # @return [Cassandra::Execution::Info]
114
139
  def execution_info
115
- @info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
140
+ @info ||= Execution::Info.new(@payload,
141
+ @warnings,
142
+ @keyspace,
143
+ @statement,
144
+ @options,
145
+ @hosts,
146
+ @consistency,
147
+ @retries,
148
+ nil)
116
149
  end
117
150
  end
118
151
 
@@ -123,7 +156,8 @@ module Cassandra
123
156
  # @note This error can be handled by a {Cassandra::Retry::Policy} to
124
157
  # determine the desired outcome.
125
158
  #
126
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L662-L672 Description of Unavailable Error in Apache Cassandra native protocol spec v1
159
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L662-L672 Description
160
+ # of Unavailable Error in Apache Cassandra native protocol spec v1
127
161
  class UnavailableError < ::StandardError
128
162
  include ExecutionError
129
163
  # Consistency level that triggered the error.
@@ -140,8 +174,27 @@ module Cassandra
140
174
  attr_reader :alive
141
175
 
142
176
  # @private
143
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries, consistency, required, alive)
144
- super(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries)
177
+ def initialize(message,
178
+ payload,
179
+ warnings,
180
+ keyspace,
181
+ statement,
182
+ options,
183
+ hosts,
184
+ r_consistency,
185
+ retries,
186
+ consistency,
187
+ required,
188
+ alive)
189
+ super(message,
190
+ payload,
191
+ warnings,
192
+ keyspace,
193
+ statement,
194
+ options,
195
+ hosts,
196
+ r_consistency,
197
+ retries)
145
198
  @consistency = consistency
146
199
  @required = required
147
200
  @alive = alive
@@ -151,7 +204,8 @@ module Cassandra
151
204
  # Raised when the request cannot be processed because the coordinator node
152
205
  # is overloaded
153
206
  #
154
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L673-L674 Description of Overloaded Error in Apache Cassandra native protocol spec v1
207
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L673-L674 Description
208
+ # of Overloaded Error in Apache Cassandra native protocol spec v1
155
209
  class OverloadedError < ::StandardError
156
210
  include ExecutionError, HostError
157
211
  end
@@ -159,21 +213,24 @@ module Cassandra
159
213
  # Raise when the request was a read request but the coordinator node is
160
214
  # bootstrapping
161
215
  #
162
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L675-L676 Description of Is Bootstrapping Error in Apache Cassandra native protocol spec v1
216
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L675-L676 Description
217
+ # of Is Bootstrapping Error in Apache Cassandra native protocol spec v1
163
218
  class IsBootstrappingError < ::StandardError
164
219
  include ExecutionError, HostError
165
220
  end
166
221
 
167
222
  # Raised when truncation failed.
168
223
  #
169
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L677 Description of Truncate Error in Apache Cassandra native protocol spec v1
224
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L677 Description of
225
+ # Truncate Error in Apache Cassandra native protocol spec v1
170
226
  class TruncateError < ::StandardError
171
227
  include ExecutionError
172
228
  end
173
229
 
174
230
  # Raised when a write request timed out.
175
231
  #
176
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L678-L703 Description of Write Timeout Error in Apache Cassandra native protocol spec v1
232
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L678-L703 Description
233
+ # of Write Timeout Error in Apache Cassandra native protocol spec v1
177
234
  class WriteTimeoutError < ::StandardError
178
235
  include ExecutionError
179
236
 
@@ -191,8 +248,28 @@ module Cassandra
191
248
  attr_reader :received
192
249
 
193
250
  # @private
194
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries, type, consistency, required, received)
195
- super(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries)
251
+ def initialize(message,
252
+ payload,
253
+ warnings,
254
+ keyspace,
255
+ statement,
256
+ options,
257
+ hosts,
258
+ r_consistency,
259
+ retries,
260
+ type,
261
+ consistency,
262
+ required,
263
+ received)
264
+ super(message,
265
+ payload,
266
+ warnings,
267
+ keyspace,
268
+ statement,
269
+ options,
270
+ hosts,
271
+ r_consistency,
272
+ retries)
196
273
  @type = type
197
274
  @consistency = consistency
198
275
  @required = required
@@ -202,13 +279,16 @@ module Cassandra
202
279
 
203
280
  # Raised when a read request timed out.
204
281
  #
205
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L704-L721 Description of Read Timeout Error in Apache Cassandra native protocol spec v1
282
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L704-L721 Description
283
+ # of Read Timeout Error in Apache Cassandra native protocol spec v1
206
284
  class ReadTimeoutError < ::StandardError
207
285
  include ExecutionError
208
286
 
209
287
  # @return [Boolean] whether actual data (as opposed to data checksum) was
210
288
  # present in the received responses.
211
289
  attr_reader :retrieved
290
+ alias retrieved? retrieved
291
+
212
292
  # @return [Symbol] the original consistency level for the request, one of
213
293
  # {Cassandra::CONSISTENCIES}
214
294
  attr_reader :consistency
@@ -220,22 +300,39 @@ module Cassandra
220
300
  attr_reader :received
221
301
 
222
302
  # @private
223
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries, retrieved, consistency, required, received)
224
- super(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries)
303
+ def initialize(message,
304
+ payload,
305
+ warnings,
306
+ keyspace,
307
+ statement,
308
+ options,
309
+ hosts,
310
+ r_consistency,
311
+ retries,
312
+ retrieved,
313
+ consistency,
314
+ required,
315
+ received)
316
+ super(message,
317
+ payload,
318
+ warnings,
319
+ keyspace,
320
+ statement,
321
+ options,
322
+ hosts,
323
+ r_consistency,
324
+ retries)
225
325
  @retrieved = retrieved
226
326
  @consistency = consistency
227
327
  @required = required
228
328
  @received = received
229
329
  end
230
-
231
- def retrieved?
232
- @retrieved
233
- end
234
330
  end
235
331
 
236
332
  # Raised when a write request fails.
237
333
  #
238
- # @see https://github.com/apache/cassandra/blob/33f1edcce97779c971d4f78712a9a8bf014ffbbc/doc/native_protocol_v4.spec#L1111-L1138 Description of Write Failure Error in Apache Cassandra native protocol spec v4
334
+ # @see https://github.com/apache/cassandra/blob/cassandra-3.4/doc/native_protocol_v4.spec#L1106-L1134 Description
335
+ # of Write Failure Error in Apache Cassandra native protocol spec v4
239
336
  class WriteError < ::StandardError
240
337
  include ExecutionError
241
338
 
@@ -253,8 +350,29 @@ module Cassandra
253
350
  attr_reader :failed
254
351
 
255
352
  # @private
256
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries, type, consistency, required, failed, received)
257
- super(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries)
353
+ def initialize(message,
354
+ payload,
355
+ warnings,
356
+ keyspace,
357
+ statement,
358
+ options,
359
+ hosts,
360
+ r_consistency,
361
+ retries,
362
+ type,
363
+ consistency,
364
+ required,
365
+ failed,
366
+ received)
367
+ super(message,
368
+ payload,
369
+ warnings,
370
+ keyspace,
371
+ statement,
372
+ options,
373
+ hosts,
374
+ r_consistency,
375
+ retries)
258
376
  @type = type
259
377
  @consistency = consistency
260
378
  @required = required
@@ -265,7 +383,8 @@ module Cassandra
265
383
 
266
384
  # Raised when a read request fails.
267
385
  #
268
- # @see https://github.com/apache/cassandra/blob/33f1edcce97779c971d4f78712a9a8bf014ffbbc/doc/native_protocol_v4.spec#L1089-L1103 Description of Read Failure Error in Apache Cassandra native protocol spec v4
386
+ # @see https://github.com/apache/cassandra/blob/cassandra-3.4/doc/native_protocol_v4.spec#L1084-L1098 Description
387
+ # of Read Failure Error in Apache Cassandra native protocol spec v4
269
388
  class ReadError < ::StandardError
270
389
  include ExecutionError
271
390
 
@@ -283,8 +402,29 @@ module Cassandra
283
402
  attr_reader :failed
284
403
 
285
404
  # @private
286
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries, retrieved, consistency, required, failed, received)
287
- super(message, payload, warnings, keyspace, statement, options, hosts, r_consistency, retries)
405
+ def initialize(message,
406
+ payload,
407
+ warnings,
408
+ keyspace,
409
+ statement,
410
+ options,
411
+ hosts,
412
+ r_consistency,
413
+ retries,
414
+ retrieved,
415
+ consistency,
416
+ required,
417
+ failed,
418
+ received)
419
+ super(message,
420
+ payload,
421
+ warnings,
422
+ keyspace,
423
+ statement,
424
+ options,
425
+ hosts,
426
+ r_consistency,
427
+ retries)
288
428
  @retrieved = retrieved
289
429
  @consistency = consistency
290
430
  @required = required
@@ -299,7 +439,8 @@ module Cassandra
299
439
 
300
440
  # Raised when function execution fails.
301
441
  #
302
- # @see https://github.com/apache/cassandra/blob/33f1edcce97779c971d4f78712a9a8bf014ffbbc/doc/native_protocol_v4.spec#L1104-L1110 Description of Function Failure Error in Apache Cassandra native protocol spec v4
442
+ # @see https://github.com/apache/cassandra/blob/cassandra-3.4/doc/native_protocol_v4.spec#L1099-L1105 Description
443
+ # of Function Failure Error in Apache Cassandra native protocol spec v4
303
444
  class FunctionCallError < ::StandardError
304
445
  include ExecutionError
305
446
 
@@ -311,8 +452,27 @@ module Cassandra
311
452
  attr_reader :signature
312
453
 
313
454
  # @private
314
- def initialize(message, payload, warnings, r_keyspace, statement, options, hosts, consistency, retries, keyspace, name, signature)
315
- super(message, payload, warnings, r_keyspace, statement, options, hosts, consistency, retries)
455
+ def initialize(message,
456
+ payload,
457
+ warnings,
458
+ r_keyspace,
459
+ statement,
460
+ options,
461
+ hosts,
462
+ consistency,
463
+ retries,
464
+ keyspace,
465
+ name,
466
+ signature)
467
+ super(message,
468
+ payload,
469
+ warnings,
470
+ r_keyspace,
471
+ statement,
472
+ options,
473
+ hosts,
474
+ consistency,
475
+ retries)
316
476
  @keyspace = keyspace
317
477
  @name = name
318
478
  @signature = signature
@@ -327,10 +487,19 @@ module Cassandra
327
487
  # Raised when some client message triggered a protocol violation (for
328
488
  # instance a QUERY message is sent before a STARTUP one has been sent)
329
489
  #
330
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L656-L658 Description of Protocol Error in Apache Cassandra native protocol spec v1
490
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L656-L658 Description
491
+ # of Protocol Error in Apache Cassandra native protocol spec v1
331
492
  class ProtocolError < ClientError
332
493
  # @private
333
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
494
+ def initialize(message,
495
+ payload,
496
+ warnings,
497
+ keyspace,
498
+ statement,
499
+ options,
500
+ hosts,
501
+ consistency,
502
+ retries)
334
503
  super(message)
335
504
  @payload = payload
336
505
  @warnings = warnings
@@ -345,16 +514,33 @@ module Cassandra
345
514
  # Query execution information, such as number of retries and all tried hosts, etc.
346
515
  # @return [Cassandra::Execution::Info]
347
516
  def execution_info
348
- @info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
517
+ @info ||= Execution::Info.new(@payload,
518
+ @warnings,
519
+ @keyspace,
520
+ @statement,
521
+ @options,
522
+ @hosts,
523
+ @consistency,
524
+ @retries,
525
+ nil)
349
526
  end
350
527
  end
351
528
 
352
529
  # Raised when cannot authenticate to Cassandra
353
530
  #
354
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L659-L660 Description of Bad Credentials Error in Apache Cassandra native protocol spec v1
531
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L659-L660 Description
532
+ # of Bad Credentials Error in Apache Cassandra native protocol spec v1
355
533
  class AuthenticationError < ClientError
356
534
  # @private
357
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
535
+ def initialize(message,
536
+ payload,
537
+ warnings,
538
+ keyspace,
539
+ statement,
540
+ options,
541
+ hosts,
542
+ consistency,
543
+ retries)
358
544
  super(message)
359
545
  @payload = payload
360
546
  @warnings = warnings
@@ -369,7 +555,15 @@ module Cassandra
369
555
  # Query execution information, such as number of retries and all tried hosts, etc.
370
556
  # @return [Cassandra::Execution::Info]
371
557
  def execution_info
372
- @info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
558
+ @info ||= Execution::Info.new(@payload,
559
+ @warnings,
560
+ @keyspace,
561
+ @statement,
562
+ @options,
563
+ @hosts,
564
+ @consistency,
565
+ @retries,
566
+ nil)
373
567
  end
374
568
  end
375
569
 
@@ -378,7 +572,15 @@ module Cassandra
378
572
  include Error
379
573
 
380
574
  # @private
381
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
575
+ def initialize(message,
576
+ payload,
577
+ warnings,
578
+ keyspace,
579
+ statement,
580
+ options,
581
+ hosts,
582
+ consistency,
583
+ retries)
382
584
  super(message)
383
585
  @payload = payload
384
586
  @warnings = warnings
@@ -393,7 +595,15 @@ module Cassandra
393
595
  # Query execution information, such as number of retries and all tried hosts, etc.
394
596
  # @return [Cassandra::Execution::Info]
395
597
  def execution_info
396
- @info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
598
+ @info ||= Execution::Info.new(@payload,
599
+ @warnings,
600
+ @keyspace,
601
+ @statement,
602
+ @options,
603
+ @hosts,
604
+ @consistency,
605
+ @retries,
606
+ nil)
397
607
  end
398
608
  end
399
609
 
@@ -403,29 +613,49 @@ module Cassandra
403
613
  # @note Seeing this error can be considered a Ruby Driver bug as it should
404
614
  # handle automatic re-preparing internally.
405
615
  #
406
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L738-L741 Description of Unprepared Error in Apache Cassandra native protocol spec v1
616
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L738-L741 Description
617
+ # of Unprepared Error in Apache Cassandra native protocol spec v1
407
618
  class UnpreparedError < ::StandardError
408
619
  include ValidationError
409
620
  # @return [String] prepared statement id that triggered the error
410
621
  attr_reader :id
411
622
 
412
623
  # @private
413
- def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries, id)
414
- super(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
624
+ def initialize(message,
625
+ payload,
626
+ warnings,
627
+ keyspace,
628
+ statement,
629
+ options,
630
+ hosts,
631
+ consistency,
632
+ retries,
633
+ id)
634
+ super(message,
635
+ payload,
636
+ warnings,
637
+ keyspace,
638
+ statement,
639
+ options,
640
+ hosts,
641
+ consistency,
642
+ retries)
415
643
  @id = id
416
644
  end
417
645
  end
418
646
 
419
647
  # Raised when the submitted query has a syntax error.
420
648
  #
421
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L723 Description of Syntax Error in Apache Cassandra native protocol spec v1
649
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L723 Description of
650
+ # Syntax Error in Apache Cassandra native protocol spec v1
422
651
  class SyntaxError < ::StandardError
423
652
  include ValidationError
424
653
  end
425
654
 
426
655
  # Raised when the logged user doesn't have the right to perform the query.
427
656
  #
428
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L724-L725 Description of Unauthorized Error in Apache Cassandra native protocol spec v1
657
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L724-L725 Description
658
+ # of Unauthorized Error in Apache Cassandra native protocol spec v1
429
659
  class UnauthorizedError < ::StandardError
430
660
  include ValidationError
431
661
  end
@@ -438,7 +668,8 @@ module Cassandra
438
668
  # rescue Cassandra::Errors::InvalidError
439
669
  # end
440
670
  #
441
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L726 Description of Invalid Error in Apache Cassandra native protocol spec v1
671
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L726 Description
672
+ # of Invalid Error in Apache Cassandra native protocol spec v1
442
673
  class InvalidError < ::StandardError
443
674
  include ValidationError
444
675
  end
@@ -451,7 +682,8 @@ module Cassandra
451
682
  # rescue Cassandra::Errors::ConfigurationError
452
683
  # end
453
684
  #
454
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L727 Description of Config Error in Apache Cassandra native protocol spec v1
685
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L727 Description of
686
+ # Config Error in Apache Cassandra native protocol spec v1
455
687
  class ConfigurationError < ::StandardError
456
688
  include ValidationError
457
689
  end
@@ -468,7 +700,8 @@ module Cassandra
468
700
  # p ['already exists', e.keyspace, e.table]
469
701
  # end
470
702
  #
471
- # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L728-L737 Description of Already Exists Error in Apache Cassandra native protocol spec v1
703
+ # @see https://github.com/apache/cassandra/blob/cassandra-2.0.16/doc/native_protocol_v1.spec#L728-L737 Description
704
+ # of Already Exists Error in Apache Cassandra native protocol spec v1
472
705
  class AlreadyExistsError < ConfigurationError
473
706
  # @return [String] keyspace
474
707
  attr_reader :keyspace
@@ -477,8 +710,26 @@ module Cassandra
477
710
  attr_reader :table
478
711
 
479
712
  # @private
480
- def initialize(message, payload, warnings, r_keyspace, statement, options, hosts, consistency, retries, keyspace, table)
481
- super(message, payload, warnings, r_keyspace, statement, options, hosts, consistency, retries)
713
+ def initialize(message,
714
+ payload,
715
+ warnings,
716
+ r_keyspace,
717
+ statement,
718
+ options,
719
+ hosts,
720
+ consistency,
721
+ retries,
722
+ keyspace,
723
+ table)
724
+ super(message,
725
+ payload,
726
+ warnings,
727
+ r_keyspace,
728
+ statement,
729
+ options,
730
+ hosts,
731
+ consistency,
732
+ retries)
482
733
  @keyspace = keyspace
483
734
  @table = table
484
735
  end
@@ -500,8 +751,8 @@ module Cassandra
500
751
  def initialize(errors = nil)
501
752
  if errors
502
753
  first = true
503
- message = "All attempted hosts failed"
504
- details = errors.each do |(host, error)|
754
+ message = 'All attempted hosts failed'
755
+ errors.each do |(host, error)|
505
756
  if first
506
757
  first = false
507
758
  message << ': '
@@ -511,7 +762,7 @@ module Cassandra
511
762
  message << "#{host.ip} (#{error.class.name}: #{error.message})"
512
763
  end
513
764
  else
514
- message = "All hosts down"
765
+ message = 'All hosts down'
515
766
  end
516
767
 
517
768
  super(message)