cassandra-driver 3.0.0.beta.1-java → 3.0.0-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 +106 -39
- data/lib/cassandra.rb +396 -148
- data/lib/cassandra/address_resolution.rb +1 -1
- data/lib/cassandra/address_resolution/policies/ec2_multi_region.rb +1 -1
- data/lib/cassandra/address_resolution/policies/none.rb +1 -1
- data/lib/cassandra/aggregate.rb +21 -7
- data/lib/cassandra/argument.rb +2 -2
- data/lib/cassandra/attr_boolean.rb +33 -0
- data/lib/cassandra/auth.rb +6 -5
- data/lib/cassandra/auth/providers.rb +1 -1
- data/lib/cassandra/auth/providers/password.rb +5 -13
- data/lib/cassandra/cassandra_logger.rb +80 -0
- data/lib/cassandra/cluster.rb +49 -9
- data/lib/cassandra/cluster/client.rb +835 -209
- data/lib/cassandra/cluster/connection_pool.rb +2 -2
- data/lib/cassandra/cluster/connector.rb +86 -27
- data/lib/cassandra/cluster/control_connection.rb +222 -95
- data/lib/cassandra/cluster/failed_connection.rb +1 -1
- data/lib/cassandra/cluster/metadata.rb +14 -8
- data/lib/cassandra/cluster/options.rb +68 -22
- data/lib/cassandra/cluster/registry.rb +81 -17
- data/lib/cassandra/cluster/schema.rb +70 -8
- data/lib/cassandra/cluster/schema/cql_type_parser.rb +15 -10
- data/lib/cassandra/cluster/schema/fetchers.rb +601 -241
- data/lib/cassandra/cluster/schema/fqcn_type_parser.rb +39 -38
- data/lib/cassandra/cluster/schema/partitioners.rb +1 -1
- data/lib/cassandra/cluster/schema/partitioners/murmur3.rb +6 -8
- data/lib/cassandra/cluster/schema/partitioners/ordered.rb +1 -1
- data/lib/cassandra/cluster/schema/partitioners/random.rb +1 -1
- data/lib/cassandra/cluster/schema/replication_strategies.rb +1 -1
- data/lib/cassandra/cluster/schema/replication_strategies/network_topology.rb +19 -18
- data/lib/cassandra/cluster/schema/replication_strategies/none.rb +1 -1
- data/lib/cassandra/cluster/schema/replication_strategies/simple.rb +1 -1
- data/lib/cassandra/column.rb +4 -23
- data/lib/cassandra/column_container.rb +322 -0
- data/lib/cassandra/compression.rb +1 -1
- data/lib/cassandra/compression/compressors/lz4.rb +7 -8
- data/lib/cassandra/compression/compressors/snappy.rb +4 -3
- data/lib/cassandra/driver.rb +107 -46
- data/lib/cassandra/errors.rb +303 -52
- data/lib/cassandra/execution/info.rb +16 -5
- data/lib/cassandra/execution/options.rb +102 -55
- data/lib/cassandra/execution/trace.rb +16 -9
- data/lib/cassandra/executors.rb +1 -1
- data/lib/cassandra/function.rb +19 -13
- data/lib/cassandra/function_collection.rb +85 -0
- data/lib/cassandra/future.rb +101 -49
- data/lib/cassandra/host.rb +25 -5
- data/lib/cassandra/index.rb +118 -0
- data/lib/cassandra/keyspace.rb +169 -33
- data/lib/cassandra/listener.rb +1 -1
- data/lib/cassandra/load_balancing.rb +2 -2
- data/lib/cassandra/load_balancing/policies.rb +1 -1
- data/lib/cassandra/load_balancing/policies/dc_aware_round_robin.rb +39 -25
- data/lib/cassandra/load_balancing/policies/round_robin.rb +8 -1
- data/lib/cassandra/load_balancing/policies/token_aware.rb +22 -13
- data/lib/cassandra/load_balancing/policies/white_list.rb +18 -5
- data/lib/cassandra/materialized_view.rb +90 -0
- data/lib/cassandra/null_logger.rb +27 -6
- data/lib/cassandra/protocol.rb +1 -1
- data/lib/cassandra/protocol/coder.rb +81 -42
- data/lib/cassandra/protocol/cql_byte_buffer.rb +58 -44
- data/lib/cassandra/protocol/cql_protocol_handler.rb +57 -54
- data/lib/cassandra/protocol/request.rb +6 -7
- data/lib/cassandra/protocol/requests/auth_response_request.rb +3 -3
- data/lib/cassandra/protocol/requests/batch_request.rb +17 -8
- data/lib/cassandra/protocol/requests/credentials_request.rb +3 -3
- data/lib/cassandra/protocol/requests/execute_request.rb +39 -20
- data/lib/cassandra/protocol/requests/options_request.rb +1 -1
- data/lib/cassandra/protocol/requests/prepare_request.rb +5 -5
- data/lib/cassandra/protocol/requests/query_request.rb +28 -23
- data/lib/cassandra/protocol/requests/register_request.rb +2 -2
- data/lib/cassandra/protocol/requests/startup_request.rb +8 -8
- data/lib/cassandra/protocol/requests/void_query_request.rb +1 -1
- data/lib/cassandra/protocol/response.rb +3 -4
- data/lib/cassandra/protocol/responses/already_exists_error_response.rb +12 -2
- data/lib/cassandra/protocol/responses/auth_challenge_response.rb +4 -5
- data/lib/cassandra/protocol/responses/auth_success_response.rb +4 -5
- data/lib/cassandra/protocol/responses/authenticate_response.rb +4 -5
- data/lib/cassandra/protocol/responses/error_response.rb +104 -17
- data/lib/cassandra/protocol/responses/event_response.rb +3 -4
- data/lib/cassandra/protocol/responses/function_failure_error_response.rb +13 -2
- data/lib/cassandra/protocol/responses/prepared_result_response.rb +14 -9
- data/lib/cassandra/protocol/responses/raw_rows_result_response.rb +14 -9
- data/lib/cassandra/protocol/responses/read_failure_error_response.rb +26 -4
- data/lib/cassandra/protocol/responses/read_timeout_error_response.rb +22 -3
- data/lib/cassandra/protocol/responses/ready_response.rb +6 -7
- data/lib/cassandra/protocol/responses/result_response.rb +11 -10
- data/lib/cassandra/protocol/responses/rows_result_response.rb +8 -7
- data/lib/cassandra/protocol/responses/schema_change_event_response.rb +8 -8
- data/lib/cassandra/protocol/responses/schema_change_result_response.rb +19 -13
- data/lib/cassandra/protocol/responses/set_keyspace_result_response.rb +5 -6
- data/lib/cassandra/protocol/responses/status_change_event_response.rb +5 -6
- data/lib/cassandra/protocol/responses/supported_response.rb +4 -5
- data/lib/cassandra/protocol/responses/topology_change_event_response.rb +4 -5
- data/lib/cassandra/protocol/responses/unavailable_error_response.rb +20 -3
- data/lib/cassandra/protocol/responses/unprepared_error_response.rb +11 -2
- data/lib/cassandra/protocol/responses/void_result_response.rb +4 -5
- data/lib/cassandra/protocol/responses/write_failure_error_response.rb +26 -4
- data/lib/cassandra/protocol/responses/write_timeout_error_response.rb +22 -3
- data/lib/cassandra/protocol/v1.rb +98 -37
- data/lib/cassandra/protocol/v3.rb +121 -50
- data/lib/cassandra/protocol/v4.rb +172 -68
- data/lib/cassandra/reconnection.rb +1 -1
- data/lib/cassandra/reconnection/policies.rb +1 -1
- data/lib/cassandra/reconnection/policies/constant.rb +2 -4
- data/lib/cassandra/reconnection/policies/exponential.rb +6 -6
- data/lib/cassandra/result.rb +55 -20
- data/lib/cassandra/retry.rb +8 -8
- data/lib/cassandra/retry/policies.rb +1 -1
- data/lib/cassandra/retry/policies/default.rb +1 -1
- data/lib/cassandra/retry/policies/downgrading_consistency.rb +4 -2
- data/lib/cassandra/retry/policies/fallthrough.rb +1 -1
- data/lib/cassandra/session.rb +24 -16
- data/lib/cassandra/statement.rb +1 -1
- data/lib/cassandra/statements.rb +1 -1
- data/lib/cassandra/statements/batch.rb +16 -10
- data/lib/cassandra/statements/bound.rb +10 -3
- data/lib/cassandra/statements/prepared.rb +62 -18
- data/lib/cassandra/statements/simple.rb +23 -10
- data/lib/cassandra/statements/void.rb +1 -1
- data/lib/cassandra/table.rb +53 -185
- data/lib/cassandra/time.rb +11 -6
- data/lib/cassandra/time_uuid.rb +12 -14
- data/lib/cassandra/timestamp_generator.rb +37 -0
- data/lib/cassandra/timestamp_generator/simple.rb +38 -0
- data/lib/cassandra/timestamp_generator/ticking_on_duplicate.rb +58 -0
- data/lib/cassandra/tuple.rb +4 -4
- data/lib/cassandra/types.rb +109 -71
- data/lib/cassandra/udt.rb +66 -50
- data/lib/cassandra/util.rb +155 -15
- data/lib/cassandra/uuid.rb +20 -21
- data/lib/cassandra/uuid/generator.rb +7 -5
- data/lib/cassandra/version.rb +2 -2
- data/lib/cassandra_murmur3.jar +0 -0
- data/lib/datastax/cassandra.rb +1 -1
- metadata +27 -16
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright 2013-
|
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,
|
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-
|
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-
|
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-
|
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-
|
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} "
|
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,
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
when
|
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,
|
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-
|
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-
|
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,
|
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-
|
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,
|
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
|
-
|
42
|
+
id == other.id && metadata == other.metadata && trace_id == other.trace_id
|
34
43
|
end
|
35
|
-
|
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}
|
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-
|
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,
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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-
|
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,
|
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,
|
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}
|
60
|
+
"#{super} #{@consistency} #{@received} #{@blockfor} #{@numfailures} " \
|
61
|
+
"#{@data_present}"
|
40
62
|
end
|
41
63
|
end
|
42
64
|
end
|