cassandra-driver 2.1.7 → 3.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- 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/datastax/cassandra.rb +5 -2
- metadata +16 -6
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright 2013-2015 DataStax, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#++
|
18
|
+
|
19
|
+
module Cassandra
|
20
|
+
module Protocol
|
21
|
+
class ReadFailureErrorResponse < ErrorResponse
|
22
|
+
attr_reader :consistency, :received, :blockfor, :numfailures, :data_present
|
23
|
+
|
24
|
+
def initialize(custom_payload, warnings, code, message, consistency, received, blockfor, numfailures, data_present)
|
25
|
+
super(custom_payload, warnings, code, message)
|
26
|
+
|
27
|
+
@consistency = consistency
|
28
|
+
@received = received
|
29
|
+
@blockfor = blockfor
|
30
|
+
@numfailures = numfailures
|
31
|
+
@data_present = data_present
|
32
|
+
end
|
33
|
+
|
34
|
+
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)
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_s
|
39
|
+
"#{super} #{@consistency} #{@received} #{@blockfor} #{@numfailures} #{@data_present}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -21,8 +21,8 @@ module Cassandra
|
|
21
21
|
class ReadTimeoutErrorResponse < ErrorResponse
|
22
22
|
attr_reader :consistency, :received, :blockfor, :data_present
|
23
23
|
|
24
|
-
def initialize(code, message, consistency, received, blockfor, data_present)
|
25
|
-
super(code, message)
|
24
|
+
def initialize(custom_payload, warnings, code, message, consistency, received, blockfor, data_present)
|
25
|
+
super(custom_payload, warnings, code, message)
|
26
26
|
|
27
27
|
@consistency = consistency
|
28
28
|
@received = received
|
@@ -30,8 +30,8 @@ module Cassandra
|
|
30
30
|
@data_present = data_present
|
31
31
|
end
|
32
32
|
|
33
|
-
def to_error(statement
|
34
|
-
Errors::ReadTimeoutError.new(@message, statement, @data_present, @consistency, @blockfor, @received)
|
33
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
34
|
+
Errors::ReadTimeoutError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries, @data_present, @consistency, @blockfor, @received)
|
35
35
|
end
|
36
36
|
|
37
37
|
def to_s
|
@@ -19,10 +19,10 @@
|
|
19
19
|
module Cassandra
|
20
20
|
module Protocol
|
21
21
|
class ResultResponse < Response
|
22
|
-
attr_reader :trace_id
|
22
|
+
attr_reader :custom_payload, :warnings, :trace_id
|
23
23
|
|
24
|
-
def initialize(trace_id)
|
25
|
-
@trace_id = trace_id
|
24
|
+
def initialize(custom_payload, warnings, trace_id)
|
25
|
+
@custom_payload, @warnings, @trace_id = custom_payload, warnings, trace_id
|
26
26
|
end
|
27
27
|
|
28
28
|
def void?
|
@@ -21,8 +21,8 @@ module Cassandra
|
|
21
21
|
class RowsResultResponse < ResultResponse
|
22
22
|
attr_reader :rows, :metadata, :paging_state
|
23
23
|
|
24
|
-
def initialize(rows, metadata, paging_state, trace_id)
|
25
|
-
super(trace_id)
|
24
|
+
def initialize(custom_payload, warnings, rows, metadata, paging_state, trace_id)
|
25
|
+
super(custom_payload, warnings, trace_id)
|
26
26
|
@rows, @metadata, @paging_state = rows, metadata, paging_state
|
27
27
|
end
|
28
28
|
|
@@ -21,47 +21,48 @@ module Cassandra
|
|
21
21
|
class SchemaChangeEventResponse < EventResponse
|
22
22
|
TYPE = 'SCHEMA_CHANGE'.freeze
|
23
23
|
|
24
|
-
attr_reader :change, :keyspace, :
|
24
|
+
attr_reader :change, :keyspace, :name, :target, :arguments
|
25
25
|
|
26
|
-
def initialize(change, keyspace, name, target
|
27
|
-
@change
|
28
|
-
@keyspace
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
@table = @type = name
|
33
|
-
else
|
34
|
-
if name.empty?
|
35
|
-
@target = Constants::SCHEMA_CHANGE_TARGET_KEYSPACE
|
36
|
-
else
|
37
|
-
@target = Constants::SCHEMA_CHANGE_TARGET_TABLE
|
38
|
-
@table = name
|
39
|
-
end
|
40
|
-
end
|
26
|
+
def initialize(change, keyspace, name, target, arguments)
|
27
|
+
@change = change
|
28
|
+
@keyspace = keyspace
|
29
|
+
@name = name
|
30
|
+
@target = target
|
31
|
+
@arguments = arguments
|
41
32
|
end
|
42
33
|
|
43
34
|
def type
|
44
35
|
TYPE
|
45
36
|
end
|
46
37
|
|
47
|
-
def eql?(
|
48
|
-
|
38
|
+
def eql?(other)
|
39
|
+
other.is_a?(SchemaChangeEventResponse) && other.type == TYPE &&
|
40
|
+
@change == other.change &&
|
41
|
+
@keyspace == other.keyspace &&
|
42
|
+
@name == other.name &&
|
43
|
+
@target == other.target &&
|
44
|
+
@arguments == other.arguments
|
49
45
|
end
|
50
46
|
alias_method :==, :eql?
|
51
47
|
|
52
48
|
def hash
|
53
49
|
@h ||= begin
|
54
|
-
h =
|
55
|
-
h =
|
56
|
-
h =
|
57
|
-
h =
|
58
|
-
h =
|
50
|
+
h = 17
|
51
|
+
h = 31 * h + @change.hash
|
52
|
+
h = 31 * h + @keyspace.hash
|
53
|
+
h = 31 * h + @name.hash
|
54
|
+
h = 31 * h + @target.hash
|
55
|
+
h = 31 * h + @arguments.hash
|
59
56
|
h
|
60
57
|
end
|
61
58
|
end
|
62
59
|
|
63
60
|
def to_s
|
64
|
-
|
61
|
+
if @arguments
|
62
|
+
%(EVENT SCHEMA_CHANGE #@change #@target "#@keyspace" "#@name" #@arguments)
|
63
|
+
else
|
64
|
+
%(EVENT SCHEMA_CHANGE #@change #@target "#@keyspace" "#@name")
|
65
|
+
end
|
65
66
|
end
|
66
67
|
|
67
68
|
private
|
@@ -19,44 +19,41 @@
|
|
19
19
|
module Cassandra
|
20
20
|
module Protocol
|
21
21
|
class SchemaChangeResultResponse < ResultResponse
|
22
|
-
attr_reader :change, :keyspace, :
|
22
|
+
attr_reader :change, :keyspace, :name, :type, :target, :arguments
|
23
23
|
|
24
|
-
def initialize(change, keyspace, name,
|
25
|
-
super(trace_id)
|
24
|
+
def initialize(custom_payload, warnings, change, keyspace, name, target, arguments, trace_id)
|
25
|
+
super(custom_payload, warnings, trace_id)
|
26
26
|
|
27
|
-
@change
|
28
|
-
@keyspace
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
@table = @type = name
|
33
|
-
else
|
34
|
-
if name.empty?
|
35
|
-
@target = Constants::SCHEMA_CHANGE_TARGET_KEYSPACE
|
36
|
-
else
|
37
|
-
@target = Constants::SCHEMA_CHANGE_TARGET_TABLE
|
38
|
-
@table = name
|
39
|
-
end
|
40
|
-
end
|
27
|
+
@change = change
|
28
|
+
@keyspace = keyspace
|
29
|
+
@name = name
|
30
|
+
@target = target
|
31
|
+
@arguments = arguments
|
41
32
|
end
|
42
33
|
|
43
34
|
def eql?(other)
|
44
|
-
|
35
|
+
@change == other.change &&
|
36
|
+
@keyspace == other.keyspace &&
|
37
|
+
@name == other.name &&
|
38
|
+
@target == other.target &&
|
39
|
+
@arguments == other.arguments
|
45
40
|
end
|
46
41
|
alias_method :==, :eql?
|
47
42
|
|
48
43
|
def hash
|
49
44
|
@h ||= begin
|
50
|
-
h =
|
51
|
-
h =
|
52
|
-
h =
|
53
|
-
h =
|
45
|
+
h = 17
|
46
|
+
h = 31 * h + @change.hash
|
47
|
+
h = 31 * h + @keyspace.hash
|
48
|
+
h = 31 * h + @name.hash
|
49
|
+
h = 31 * h + @target.hash
|
50
|
+
h = 31 * h + @arguments.hash
|
54
51
|
h
|
55
52
|
end
|
56
53
|
end
|
57
54
|
|
58
55
|
def to_s
|
59
|
-
%(RESULT SCHEMA_CHANGE #@change #@target "#@keyspace" "#@
|
56
|
+
%(RESULT SCHEMA_CHANGE #@change #@target "#@keyspace" "#@name")
|
60
57
|
end
|
61
58
|
|
62
59
|
private
|
@@ -21,8 +21,8 @@ module Cassandra
|
|
21
21
|
class SetKeyspaceResultResponse < ResultResponse
|
22
22
|
attr_reader :keyspace
|
23
23
|
|
24
|
-
def initialize(keyspace, trace_id)
|
25
|
-
super(trace_id)
|
24
|
+
def initialize(custom_payload, warnings, keyspace, trace_id)
|
25
|
+
super(custom_payload, warnings, trace_id)
|
26
26
|
@keyspace = keyspace
|
27
27
|
end
|
28
28
|
|
@@ -21,16 +21,16 @@ module Cassandra
|
|
21
21
|
class UnavailableErrorResponse < ErrorResponse
|
22
22
|
attr_reader :consistency, :required, :alive
|
23
23
|
|
24
|
-
def initialize(code, message, consistency, required, alive)
|
25
|
-
super(code, message)
|
24
|
+
def initialize(custom_payload, warnings, code, message, consistency, required, alive)
|
25
|
+
super(custom_payload, warnings, code, message)
|
26
26
|
|
27
27
|
@consistency = consistency
|
28
28
|
@required = required
|
29
29
|
@alive = alive
|
30
30
|
end
|
31
31
|
|
32
|
-
def to_error(statement
|
33
|
-
Errors::UnavailableError.new(@message, statement, @consistency, @required, @alive)
|
32
|
+
def to_error(keyspace, statement, options, hosts, r_consistency, retries)
|
33
|
+
Errors::UnavailableError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, r_consistency, retries, @consistency, @required, @alive)
|
34
34
|
end
|
35
35
|
|
36
36
|
def to_s
|
@@ -21,14 +21,14 @@ module Cassandra
|
|
21
21
|
class UnpreparedErrorResponse < ErrorResponse
|
22
22
|
attr_reader :id
|
23
23
|
|
24
|
-
def initialize(code, message, id)
|
25
|
-
super(code, message)
|
24
|
+
def initialize(custom_payload, warnings, code, message, id)
|
25
|
+
super(custom_payload, warnings, code, message)
|
26
26
|
|
27
27
|
@id = id
|
28
28
|
end
|
29
29
|
|
30
|
-
def to_error(statement
|
31
|
-
Errors::UnpreparedError.new(@message, statement, @id)
|
30
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
31
|
+
Errors::UnpreparedError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries, @id)
|
32
32
|
end
|
33
33
|
|
34
34
|
def to_s
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright 2013-2015 DataStax, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#++
|
18
|
+
|
19
|
+
module Cassandra
|
20
|
+
module Protocol
|
21
|
+
class WriteFailureErrorResponse < ErrorResponse
|
22
|
+
attr_reader :consistency, :received, :blockfor, :numfailures, :write_type
|
23
|
+
|
24
|
+
def initialize(custom_payload, warnings, code, message, consistency, received, blockfor, numfailures, write_type)
|
25
|
+
super(custom_payload, warnings, code, message)
|
26
|
+
|
27
|
+
write_type.downcase!
|
28
|
+
|
29
|
+
@consistency = consistency
|
30
|
+
@received = received
|
31
|
+
@blockfor = blockfor
|
32
|
+
@numfailures = numfailures
|
33
|
+
@write_type = write_type.to_sym
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
37
|
+
Errors::WriteError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries, @write_type, @consistency, @blockfor, @numfailures, @received)
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_s
|
41
|
+
"#{super} #{@write_type} #{@consistency} #{@blockfor} #{@numfailures} #{@received}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -21,8 +21,8 @@ module Cassandra
|
|
21
21
|
class WriteTimeoutErrorResponse < ErrorResponse
|
22
22
|
attr_reader :consistency, :received, :blockfor, :write_type
|
23
23
|
|
24
|
-
def initialize(code, message, consistency, received, blockfor, write_type)
|
25
|
-
super(code, message)
|
24
|
+
def initialize(custom_payload, warnings, code, message, consistency, received, blockfor, write_type)
|
25
|
+
super(custom_payload, warnings, code, message)
|
26
26
|
|
27
27
|
write_type.downcase!
|
28
28
|
|
@@ -32,8 +32,8 @@ module Cassandra
|
|
32
32
|
@write_type = write_type.to_sym
|
33
33
|
end
|
34
34
|
|
35
|
-
def to_error(statement
|
36
|
-
Errors::WriteTimeoutError.new(@message, statement, @write_type, @consistency, @blockfor, @received)
|
35
|
+
def to_error(keyspace, statement, options, hosts, consistency, retries)
|
36
|
+
Errors::WriteTimeoutError.new(@message, @custom_payload, @warnings, keyspace, statement, options, hosts, consistency, retries, @write_type, @consistency, @blockfor, @received)
|
37
37
|
end
|
38
38
|
|
39
39
|
def to_s
|
@@ -179,19 +179,19 @@ module Cassandra
|
|
179
179
|
message = buffer.read_string
|
180
180
|
|
181
181
|
case code
|
182
|
-
when 0x1000 then UnavailableErrorResponse.new(code, message, buffer.read_consistency, buffer.read_int, buffer.read_int)
|
183
|
-
when 0x1100 then WriteTimeoutErrorResponse.new(code, message, buffer.read_consistency, buffer.read_int, buffer.read_int, buffer.read_string)
|
184
|
-
when 0x1200 then ReadTimeoutErrorResponse.new(code, message, buffer.read_consistency, buffer.read_int, buffer.read_int, (buffer.read_byte != 0))
|
185
|
-
when 0x2400 then AlreadyExistsErrorResponse.new(code, message, buffer.read_string, buffer.read_string)
|
186
|
-
when 0x2500 then UnpreparedErrorResponse.new(code, message, buffer.read_short_bytes)
|
182
|
+
when 0x1000 then UnavailableErrorResponse.new(nil, nil, code, message, buffer.read_consistency, buffer.read_int, buffer.read_int)
|
183
|
+
when 0x1100 then WriteTimeoutErrorResponse.new(nil, nil, code, message, buffer.read_consistency, buffer.read_int, buffer.read_int, buffer.read_string)
|
184
|
+
when 0x1200 then ReadTimeoutErrorResponse.new(nil, nil, code, message, buffer.read_consistency, buffer.read_int, buffer.read_int, (buffer.read_byte != 0))
|
185
|
+
when 0x2400 then AlreadyExistsErrorResponse.new(nil, nil, code, message, buffer.read_string, buffer.read_string)
|
186
|
+
when 0x2500 then UnpreparedErrorResponse.new(nil, nil, code, message, buffer.read_short_bytes)
|
187
187
|
else
|
188
|
-
ErrorResponse.new(code, message)
|
188
|
+
ErrorResponse.new(nil, nil, code, message)
|
189
189
|
end
|
190
190
|
when CODE_RESULT
|
191
191
|
result_type = buffer.read_int
|
192
192
|
case result_type
|
193
193
|
when 0x0001 # Void
|
194
|
-
VoidResultResponse.new(trace_id)
|
194
|
+
VoidResultResponse.new(nil, nil, trace_id)
|
195
195
|
when 0x0002 # Rows
|
196
196
|
original_buffer_length = buffer.length
|
197
197
|
column_specs, paging_state = Coder.read_metadata_v1(buffer)
|
@@ -199,21 +199,34 @@ module Cassandra
|
|
199
199
|
if column_specs.nil?
|
200
200
|
consumed_bytes = original_buffer_length - buffer.length
|
201
201
|
remaining_bytes = CqlByteBuffer.new(buffer.read(size - consumed_bytes - 4))
|
202
|
-
RawRowsResultResponse.new(protocol_version, remaining_bytes, paging_state, trace_id)
|
202
|
+
RawRowsResultResponse.new(nil, nil, protocol_version, remaining_bytes, paging_state, trace_id)
|
203
203
|
else
|
204
|
-
RowsResultResponse.new(Coder.read_values_v1(buffer, column_specs), column_specs, paging_state, trace_id)
|
204
|
+
RowsResultResponse.new(nil, nil, Coder.read_values_v1(buffer, column_specs), column_specs, paging_state, trace_id)
|
205
205
|
end
|
206
206
|
when 0x0003 # SetKeyspace
|
207
|
-
SetKeyspaceResultResponse.new(buffer.read_string, trace_id)
|
207
|
+
SetKeyspaceResultResponse.new(nil, nil, buffer.read_string, trace_id)
|
208
208
|
when 0x0004 # Prepared
|
209
209
|
id = buffer.read_short_bytes
|
210
210
|
params_metadata = Coder.read_metadata_v1(buffer).first
|
211
211
|
result_metadata = nil
|
212
212
|
result_metadata = Coder.read_metadata_v1(buffer).first if protocol_version > 1
|
213
213
|
|
214
|
-
PreparedResultResponse.new(id, params_metadata, result_metadata, trace_id)
|
214
|
+
PreparedResultResponse.new(nil, nil, id, params_metadata, result_metadata, nil, trace_id)
|
215
215
|
when 0x0005 # SchemaChange
|
216
|
-
|
216
|
+
change = buffer.read_string
|
217
|
+
keyspace = buffer.read_string
|
218
|
+
name = buffer.read_string
|
219
|
+
arguments = EMPTY_LIST
|
220
|
+
target = nil
|
221
|
+
|
222
|
+
if name.empty?
|
223
|
+
name = nil
|
224
|
+
target = Constants::SCHEMA_CHANGE_TARGET_KEYSPACE
|
225
|
+
else
|
226
|
+
target = Constants::SCHEMA_CHANGE_TARGET_TABLE
|
227
|
+
end
|
228
|
+
|
229
|
+
SchemaChangeResultResponse.new(nil, nil, change, keyspace, name, target, arguments, nil)
|
217
230
|
else
|
218
231
|
raise Errors::DecodingError, "Unsupported result type: #{result_type.inspect}"
|
219
232
|
end
|
@@ -221,7 +234,19 @@ module Cassandra
|
|
221
234
|
event_type = buffer.read_string
|
222
235
|
case event_type
|
223
236
|
when 'SCHEMA_CHANGE'
|
224
|
-
|
237
|
+
change = buffer.read_string
|
238
|
+
keyspace = buffer.read_string
|
239
|
+
name = buffer.read_string
|
240
|
+
arguments = EMPTY_LIST
|
241
|
+
|
242
|
+
if name.empty?
|
243
|
+
name = nil
|
244
|
+
target = Constants::SCHEMA_CHANGE_TARGET_KEYSPACE
|
245
|
+
else
|
246
|
+
target = Constants::SCHEMA_CHANGE_TARGET_TABLE
|
247
|
+
end
|
248
|
+
|
249
|
+
SchemaChangeEventResponse.new(change, keyspace, name, target, arguments)
|
225
250
|
when 'STATUS_CHANGE'
|
226
251
|
StatusChangeEventResponse.new(buffer.read_string, *buffer.read_inet)
|
227
252
|
when 'TOPOLOGY_CHANGE'
|