cassandra-driver 2.1.7-java → 3.0.0.beta.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +31 -53
- data/lib/cassandra.rb +22 -3
- data/lib/cassandra/aggregate.rb +109 -0
- data/lib/cassandra/argument.rb +51 -0
- data/lib/cassandra/auth/providers/password.rb +7 -4
- data/lib/cassandra/cluster.rb +14 -3
- data/lib/cassandra/cluster/client.rb +56 -34
- data/lib/cassandra/cluster/connector.rb +6 -6
- data/lib/cassandra/cluster/control_connection.rb +204 -251
- data/lib/cassandra/cluster/metadata.rb +2 -0
- data/lib/cassandra/cluster/schema.rb +131 -209
- data/lib/cassandra/cluster/schema/cql_type_parser.rb +104 -0
- data/lib/cassandra/cluster/schema/fetchers.rb +1174 -0
- data/lib/cassandra/cluster/schema/{type_parser.rb → fqcn_type_parser.rb} +7 -3
- data/lib/cassandra/column.rb +2 -2
- data/lib/cassandra/driver.rb +27 -9
- data/lib/cassandra/errors.rb +179 -25
- data/lib/cassandra/execution/info.rb +8 -1
- data/lib/cassandra/execution/options.rb +34 -0
- data/lib/cassandra/execution/trace.rb +42 -10
- data/lib/cassandra/function.rb +150 -0
- data/lib/cassandra/future.rb +66 -35
- data/lib/cassandra/host.rb +7 -4
- data/lib/cassandra/keyspace.rb +112 -13
- data/lib/cassandra/load_balancing.rb +1 -1
- data/lib/cassandra/protocol.rb +9 -3
- data/lib/cassandra/protocol/coder.rb +434 -155
- data/lib/cassandra/protocol/cql_byte_buffer.rb +43 -0
- data/lib/cassandra/protocol/cql_protocol_handler.rb +4 -1
- data/lib/cassandra/protocol/request.rb +4 -0
- data/lib/cassandra/protocol/requests/auth_response_request.rb +5 -1
- data/lib/cassandra/protocol/requests/batch_request.rb +7 -2
- data/lib/cassandra/protocol/requests/credentials_request.rb +5 -1
- data/lib/cassandra/protocol/requests/execute_request.rb +16 -10
- data/lib/cassandra/protocol/requests/prepare_request.rb +12 -3
- data/lib/cassandra/protocol/requests/query_request.rb +20 -11
- data/lib/cassandra/protocol/responses/already_exists_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/error_response.rb +14 -14
- data/lib/cassandra/protocol/responses/function_failure_error_response.rb +41 -0
- data/lib/cassandra/protocol/responses/prepared_result_response.rb +12 -9
- data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +5 -3
- data/lib/cassandra/protocol/responses/read_failure_error_response.rb +43 -0
- data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/ready_response.rb +5 -1
- data/lib/cassandra/protocol/responses/result_response.rb +3 -3
- data/lib/cassandra/protocol/responses/rows_result_response.rb +2 -2
- data/lib/cassandra/protocol/responses/schema_change_event_response.rb +25 -24
- data/lib/cassandra/protocol/responses/schema_change_result_response.rb +20 -23
- data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +2 -2
- data/lib/cassandra/protocol/responses/unavailable_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/unprepared_error_response.rb +4 -4
- data/lib/cassandra/protocol/responses/write_failure_error_response.rb +45 -0
- data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +4 -4
- data/lib/cassandra/protocol/v1.rb +38 -13
- data/lib/cassandra/protocol/v3.rb +34 -29
- data/lib/cassandra/protocol/v4.rb +334 -0
- data/lib/cassandra/result.rb +10 -9
- data/lib/cassandra/retry.rb +17 -3
- data/lib/cassandra/retry/policies/default.rb +9 -3
- data/lib/cassandra/session.rb +15 -7
- data/lib/cassandra/statement.rb +5 -0
- data/lib/cassandra/statements/batch.rb +36 -12
- data/lib/cassandra/statements/bound.rb +2 -1
- data/lib/cassandra/statements/prepared.rb +106 -35
- data/lib/cassandra/statements/simple.rb +4 -2
- data/lib/cassandra/table.rb +70 -105
- data/lib/cassandra/time.rb +98 -0
- data/lib/cassandra/time_uuid.rb +1 -1
- data/lib/cassandra/tuple.rb +7 -0
- data/lib/cassandra/types.rb +472 -272
- data/lib/cassandra/udt.rb +10 -0
- data/lib/cassandra/util.rb +32 -1
- data/lib/cassandra/uuid.rb +6 -1
- data/lib/cassandra/uuid/generator.rb +7 -7
- data/lib/cassandra/version.rb +1 -1
- data/lib/cassandra_murmur3.jar +0 -0
- data/lib/datastax/cassandra.rb +5 -2
- metadata +27 -17
@@ -19,7 +19,7 @@
|
|
19
19
|
module Cassandra
|
20
20
|
class Cluster
|
21
21
|
class Schema
|
22
|
-
class
|
22
|
+
class FQCNTypeParser
|
23
23
|
# @private
|
24
24
|
Node = Struct.new(:parent, :name, :children)
|
25
25
|
# @private
|
@@ -36,7 +36,7 @@ module Cassandra
|
|
36
36
|
"org.apache.cassandra.db.marshal.FloatType" => :float,
|
37
37
|
"org.apache.cassandra.db.marshal.InetAddressType" => :inet,
|
38
38
|
"org.apache.cassandra.db.marshal.Int32Type" => :int,
|
39
|
-
"org.apache.cassandra.db.marshal.UTF8Type" => :
|
39
|
+
"org.apache.cassandra.db.marshal.UTF8Type" => :text,
|
40
40
|
"org.apache.cassandra.db.marshal.TimestampType" => :timestamp,
|
41
41
|
"org.apache.cassandra.db.marshal.DateType" => :timestamp,
|
42
42
|
"org.apache.cassandra.db.marshal.UUIDType" => :uuid,
|
@@ -46,7 +46,11 @@ module Cassandra
|
|
46
46
|
"org.apache.cassandra.db.marshal.SetType" => :set,
|
47
47
|
"org.apache.cassandra.db.marshal.ListType" => :list,
|
48
48
|
"org.apache.cassandra.db.marshal.UserType" => :udt,
|
49
|
-
"org.apache.cassandra.db.marshal.TupleType" => :tuple
|
49
|
+
"org.apache.cassandra.db.marshal.TupleType" => :tuple,
|
50
|
+
"org.apache.cassandra.db.marshal.ShortType" => :smallint,
|
51
|
+
"org.apache.cassandra.db.marshal.ByteType" => :tinyint,
|
52
|
+
"org.apache.cassandra.db.marshal.TimeType" => :time,
|
53
|
+
"org.apache.cassandra.db.marshal.SimpleDateType" => :date,
|
50
54
|
}.freeze
|
51
55
|
|
52
56
|
def parse(string)
|
data/lib/cassandra/column.rb
CHANGED
@@ -65,12 +65,12 @@ module Cassandra
|
|
65
65
|
@frozen
|
66
66
|
end
|
67
67
|
|
68
|
-
# @
|
68
|
+
# @private
|
69
69
|
def inspect
|
70
70
|
"#<#{self.class.name}:0x#{self.object_id.to_s(16)} @name=#{@name} @type=#{@type}>"
|
71
71
|
end
|
72
72
|
|
73
|
-
# @
|
73
|
+
# @private
|
74
74
|
def eql?(other)
|
75
75
|
other.is_a?(Column) &&
|
76
76
|
@name == other.name &&
|
data/lib/cassandra/driver.rb
CHANGED
@@ -26,7 +26,7 @@ module Cassandra
|
|
26
26
|
|
27
27
|
let(:io_reactor) { Ione::Io::IoReactor.new }
|
28
28
|
let(:cluster_registry) { Cluster::Registry.new(logger) }
|
29
|
-
let(:cluster_schema) { Cluster::Schema.new
|
29
|
+
let(:cluster_schema) { Cluster::Schema.new }
|
30
30
|
let(:cluster_metadata) { Cluster::Metadata.new(
|
31
31
|
cluster_registry,
|
32
32
|
cluster_schema,
|
@@ -36,8 +36,8 @@ module Cassandra
|
|
36
36
|
'org.apache.cassandra.dht.RandomPartitioner' => random_partitioner
|
37
37
|
}.freeze,
|
38
38
|
{
|
39
|
-
'
|
40
|
-
'
|
39
|
+
'SimpleStrategy' => simple_replication_strategy,
|
40
|
+
'NetworkTopologyStrategy' => network_topology_replication_strategy
|
41
41
|
}.freeze,
|
42
42
|
no_replication_strategy
|
43
43
|
)
|
@@ -46,7 +46,8 @@ module Cassandra
|
|
46
46
|
let(:executor) { Executors::ThreadPool.new(thread_pool_size) }
|
47
47
|
let(:futures_factory) { Future::Factory.new(executor) }
|
48
48
|
|
49
|
-
let(:
|
49
|
+
let(:schema_fqcn_type_parser) { Cluster::Schema::FQCNTypeParser.new }
|
50
|
+
let(:schema_cql_type_parser) { Cluster::Schema::CQLTypeParser.new }
|
50
51
|
|
51
52
|
let(:simple_replication_strategy) { Cluster::Schema::ReplicationStrategies::Simple.new }
|
52
53
|
let(:network_topology_replication_strategy) { Cluster::Schema::ReplicationStrategies::NetworkTopology.new }
|
@@ -58,7 +59,9 @@ module Cassandra
|
|
58
59
|
|
59
60
|
let(:connector) { Cluster::Connector.new(logger, io_reactor, cluster_registry, connection_options, execution_options) }
|
60
61
|
|
61
|
-
let(:
|
62
|
+
let(:schema_fetcher) { create_schema_fetcher_picker }
|
63
|
+
|
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) }
|
62
65
|
|
63
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) }
|
64
67
|
|
@@ -67,7 +70,8 @@ module Cassandra
|
|
67
70
|
:consistency => consistency,
|
68
71
|
:trace => trace,
|
69
72
|
:page_size => page_size,
|
70
|
-
:timeout => timeout
|
73
|
+
:timeout => timeout,
|
74
|
+
:idempotent => false
|
71
75
|
})
|
72
76
|
end
|
73
77
|
|
@@ -93,7 +97,7 @@ module Cassandra
|
|
93
97
|
end
|
94
98
|
|
95
99
|
let(:port) { 9042 }
|
96
|
-
let(:protocol_version) {
|
100
|
+
let(:protocol_version) { 4 }
|
97
101
|
let(:connect_timeout) { 10 }
|
98
102
|
let(:ssl) { false }
|
99
103
|
let(:logger) { NullLogger.new }
|
@@ -105,7 +109,7 @@ module Cassandra
|
|
105
109
|
let(:reconnection_policy) { Reconnection::Policies::Exponential.new(0.5, 30, 2) }
|
106
110
|
let(:retry_policy) { Retry::Policies::Default.new }
|
107
111
|
let(:address_resolution_policy) { AddressResolution::Policies::None.new }
|
108
|
-
let(:consistency) { :
|
112
|
+
let(:consistency) { :local_one }
|
109
113
|
let(:trace) { false }
|
110
114
|
let(:page_size) { 10000 }
|
111
115
|
let(:heartbeat_interval) { 30 }
|
@@ -117,7 +121,7 @@ module Cassandra
|
|
117
121
|
let(:thread_pool_size) { 4 }
|
118
122
|
let(:shuffle_replicas) { true }
|
119
123
|
let(:client_timestamps) { false }
|
120
|
-
let(:nodelay) {
|
124
|
+
let(:nodelay) { true }
|
121
125
|
|
122
126
|
let(:connections_per_local_node) { 2 }
|
123
127
|
let(:connections_per_remote_node) { 1 }
|
@@ -156,5 +160,19 @@ module Cassandra
|
|
156
160
|
|
157
161
|
promise.future
|
158
162
|
end
|
163
|
+
|
164
|
+
private
|
165
|
+
|
166
|
+
def create_schema_fetcher_picker
|
167
|
+
picker = Cluster::Schema::Fetchers::MultiVersion.new(cluster_registry)
|
168
|
+
|
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) }
|
174
|
+
|
175
|
+
picker
|
176
|
+
end
|
159
177
|
end
|
160
178
|
end
|
data/lib/cassandra/errors.rb
CHANGED
@@ -46,6 +46,25 @@ module Cassandra
|
|
46
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
|
47
47
|
class ServerError < ::StandardError
|
48
48
|
include Error, HostError
|
49
|
+
|
50
|
+
# @private
|
51
|
+
def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
|
52
|
+
super(message)
|
53
|
+
@payload = payload
|
54
|
+
@warnings = warnings
|
55
|
+
@keyspace = keyspace
|
56
|
+
@statement = statement
|
57
|
+
@options = options
|
58
|
+
@hosts = hosts
|
59
|
+
@consistency = consistency
|
60
|
+
@retries = retries
|
61
|
+
end
|
62
|
+
|
63
|
+
# Query execution information, such as number of retries and all tried hosts, etc.
|
64
|
+
# @return [Cassandra::Execution::Info]
|
65
|
+
def execution_info
|
66
|
+
@info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
|
67
|
+
end
|
49
68
|
end
|
50
69
|
|
51
70
|
# Mixed into all internal driver errors.
|
@@ -70,21 +89,30 @@ module Cassandra
|
|
70
89
|
|
71
90
|
# Raised when a timeout has occured.
|
72
91
|
class TimeoutError < ::Timeout::Error
|
73
|
-
include Error
|
92
|
+
include Error
|
74
93
|
end
|
75
94
|
|
76
95
|
# Mixed into all request execution errors.
|
77
96
|
module ExecutionError
|
78
97
|
include Error
|
79
98
|
|
80
|
-
# @return [Cassandra::Statement] statement that triggered the error.
|
81
|
-
attr_reader :statement
|
82
|
-
|
83
99
|
# @private
|
84
|
-
def initialize(message, statement)
|
100
|
+
def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
|
85
101
|
super(message)
|
102
|
+
@payload = payload
|
103
|
+
@warnings = warnings
|
104
|
+
@keyspace = keyspace
|
105
|
+
@statement = statement
|
106
|
+
@options = options
|
107
|
+
@hosts = hosts
|
108
|
+
@consistency = consistency
|
109
|
+
@retries = retries
|
110
|
+
end
|
86
111
|
|
87
|
-
|
112
|
+
# Query execution information, such as number of retries and all tried hosts, etc.
|
113
|
+
# @return [Cassandra::Execution::Info]
|
114
|
+
def execution_info
|
115
|
+
@info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
|
88
116
|
end
|
89
117
|
end
|
90
118
|
|
@@ -112,9 +140,8 @@ module Cassandra
|
|
112
140
|
attr_reader :alive
|
113
141
|
|
114
142
|
# @private
|
115
|
-
def initialize(message, statement, consistency, required, alive)
|
116
|
-
super(message, statement)
|
117
|
-
|
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)
|
118
145
|
@consistency = consistency
|
119
146
|
@required = required
|
120
147
|
@alive = alive
|
@@ -164,9 +191,8 @@ module Cassandra
|
|
164
191
|
attr_reader :received
|
165
192
|
|
166
193
|
# @private
|
167
|
-
def initialize(message, statement, type, consistency, required, received)
|
168
|
-
super(message, statement)
|
169
|
-
|
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)
|
170
196
|
@type = type
|
171
197
|
@consistency = consistency
|
172
198
|
@required = required
|
@@ -194,12 +220,75 @@ module Cassandra
|
|
194
220
|
attr_reader :received
|
195
221
|
|
196
222
|
# @private
|
197
|
-
def initialize(message, statement, retrieved, consistency, required, received)
|
198
|
-
super(message, statement)
|
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)
|
225
|
+
@retrieved = retrieved
|
226
|
+
@consistency = consistency
|
227
|
+
@required = required
|
228
|
+
@received = received
|
229
|
+
end
|
230
|
+
|
231
|
+
def retrieved?
|
232
|
+
@retrieved
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
# Raised when a write request fails.
|
237
|
+
#
|
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
|
239
|
+
class WriteError < ::StandardError
|
240
|
+
include ExecutionError
|
241
|
+
|
242
|
+
# @return [Symbol] the type of write request that timed out, one of
|
243
|
+
# {Cassandra::WRITE_TYPES}
|
244
|
+
attr_reader :type
|
245
|
+
# @return [Symbol] the original consistency level for the request, one of
|
246
|
+
# {Cassandra::CONSISTENCIES}
|
247
|
+
attr_reader :consistency
|
248
|
+
# @return [Integer] the number of acks required
|
249
|
+
attr_reader :required
|
250
|
+
# @return [Integer] the number of acks received
|
251
|
+
attr_reader :received
|
252
|
+
# @return [Integer] the number of writes failed
|
253
|
+
attr_reader :failed
|
254
|
+
|
255
|
+
# @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)
|
258
|
+
@type = type
|
259
|
+
@consistency = consistency
|
260
|
+
@required = required
|
261
|
+
@failed = failed
|
262
|
+
@received = received
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
# Raised when a read request fails.
|
267
|
+
#
|
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
|
269
|
+
class ReadError < ::StandardError
|
270
|
+
include ExecutionError
|
199
271
|
|
272
|
+
# @return [Boolean] whether actual data (as opposed to data checksum) was
|
273
|
+
# present in the received responses.
|
274
|
+
attr_reader :retrieved
|
275
|
+
# @return [Symbol] the original consistency level for the request, one of
|
276
|
+
# {Cassandra::CONSISTENCIES}
|
277
|
+
attr_reader :consistency
|
278
|
+
# @return [Integer] the number of responses required
|
279
|
+
attr_reader :required
|
280
|
+
# @return [Integer] the number of responses received
|
281
|
+
attr_reader :received
|
282
|
+
# @return [Integer] the number of reads failed
|
283
|
+
attr_reader :failed
|
284
|
+
|
285
|
+
# @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)
|
200
288
|
@retrieved = retrieved
|
201
289
|
@consistency = consistency
|
202
290
|
@required = required
|
291
|
+
@failed = failed
|
203
292
|
@received = received
|
204
293
|
end
|
205
294
|
|
@@ -208,6 +297,28 @@ module Cassandra
|
|
208
297
|
end
|
209
298
|
end
|
210
299
|
|
300
|
+
# Raised when function execution fails.
|
301
|
+
#
|
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
|
303
|
+
class FunctionCallError < ::StandardError
|
304
|
+
include ExecutionError
|
305
|
+
|
306
|
+
# @return [String] keyspace
|
307
|
+
attr_reader :keyspace
|
308
|
+
# @return [String] name
|
309
|
+
attr_reader :name
|
310
|
+
# @return [String] signature
|
311
|
+
attr_reader :signature
|
312
|
+
|
313
|
+
# @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)
|
316
|
+
@keyspace = keyspace
|
317
|
+
@name = name
|
318
|
+
@signature = signature
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
211
322
|
# Client error represents bad driver state or mis-configuration
|
212
323
|
class ClientError < ::StandardError
|
213
324
|
include Error
|
@@ -218,26 +329,71 @@ module Cassandra
|
|
218
329
|
#
|
219
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
|
220
331
|
class ProtocolError < ClientError
|
332
|
+
# @private
|
333
|
+
def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
|
334
|
+
super(message)
|
335
|
+
@payload = payload
|
336
|
+
@warnings = warnings
|
337
|
+
@keyspace = keyspace
|
338
|
+
@statement = statement
|
339
|
+
@options = options
|
340
|
+
@hosts = hosts
|
341
|
+
@consistency = consistency
|
342
|
+
@retries = retries
|
343
|
+
end
|
344
|
+
|
345
|
+
# Query execution information, such as number of retries and all tried hosts, etc.
|
346
|
+
# @return [Cassandra::Execution::Info]
|
347
|
+
def execution_info
|
348
|
+
@info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
|
349
|
+
end
|
221
350
|
end
|
222
351
|
|
223
352
|
# Raised when cannot authenticate to Cassandra
|
224
353
|
#
|
225
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
|
226
355
|
class AuthenticationError < ClientError
|
356
|
+
# @private
|
357
|
+
def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
|
358
|
+
super(message)
|
359
|
+
@payload = payload
|
360
|
+
@warnings = warnings
|
361
|
+
@keyspace = keyspace
|
362
|
+
@statement = statement
|
363
|
+
@options = options
|
364
|
+
@hosts = hosts
|
365
|
+
@consistency = consistency
|
366
|
+
@retries = retries
|
367
|
+
end
|
368
|
+
|
369
|
+
# Query execution information, such as number of retries and all tried hosts, etc.
|
370
|
+
# @return [Cassandra::Execution::Info]
|
371
|
+
def execution_info
|
372
|
+
@info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
|
373
|
+
end
|
227
374
|
end
|
228
375
|
|
229
376
|
# Mixed into all request validation errors.
|
230
377
|
module ValidationError
|
231
378
|
include Error
|
232
379
|
|
233
|
-
# @return [Cassandra::Statement] statement that triggered the error.
|
234
|
-
attr_reader :statement
|
235
|
-
|
236
380
|
# @private
|
237
|
-
def initialize(message, statement)
|
381
|
+
def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
|
238
382
|
super(message)
|
383
|
+
@payload = payload
|
384
|
+
@warnings = warnings
|
385
|
+
@keyspace = keyspace
|
386
|
+
@statement = statement
|
387
|
+
@options = options
|
388
|
+
@hosts = hosts
|
389
|
+
@consistency = consistency
|
390
|
+
@retries = retries
|
391
|
+
end
|
239
392
|
|
240
|
-
|
393
|
+
# Query execution information, such as number of retries and all tried hosts, etc.
|
394
|
+
# @return [Cassandra::Execution::Info]
|
395
|
+
def execution_info
|
396
|
+
@info ||= Execution::Info.new(@payload, @warnings, @keyspace, @statement, @options, @hosts, @consistency, @retries, nil)
|
241
397
|
end
|
242
398
|
end
|
243
399
|
|
@@ -254,9 +410,8 @@ module Cassandra
|
|
254
410
|
attr_reader :id
|
255
411
|
|
256
412
|
# @private
|
257
|
-
def initialize(message, statement, id)
|
258
|
-
super(message, statement)
|
259
|
-
|
413
|
+
def initialize(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries, id)
|
414
|
+
super(message, payload, warnings, keyspace, statement, options, hosts, consistency, retries)
|
260
415
|
@id = id
|
261
416
|
end
|
262
417
|
end
|
@@ -322,9 +477,8 @@ module Cassandra
|
|
322
477
|
attr_reader :table
|
323
478
|
|
324
479
|
# @private
|
325
|
-
def initialize(message, statement, keyspace, table)
|
326
|
-
super(message, statement)
|
327
|
-
|
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)
|
328
482
|
@keyspace = keyspace
|
329
483
|
@table = table
|
330
484
|
end
|
@@ -19,6 +19,11 @@
|
|
19
19
|
module Cassandra
|
20
20
|
module Execution
|
21
21
|
class Info
|
22
|
+
# @return [Hash<String, String>] a map of string keys and byte buffer
|
23
|
+
# values, containing custom payloads sent by custom query handlers
|
24
|
+
attr_reader :payload
|
25
|
+
# @return [Array<String>] a list of string warnings from the server
|
26
|
+
attr_reader :warnings
|
22
27
|
# @return [String] keyspace used for the query
|
23
28
|
attr_reader :keyspace
|
24
29
|
# @return [Cassandra::Statement] original statement
|
@@ -37,7 +42,9 @@ module Cassandra
|
|
37
42
|
attr_reader :trace
|
38
43
|
|
39
44
|
# @private
|
40
|
-
def initialize(keyspace, statement, options, hosts, consistency, retries, trace)
|
45
|
+
def initialize(payload, warnings, keyspace, statement, options, hosts, consistency, retries, trace)
|
46
|
+
@payload = payload
|
47
|
+
@warnings = warnings
|
41
48
|
@keyspace = keyspace
|
42
49
|
@statement = statement
|
43
50
|
@options = options
|