cql-rb 1.1.1 → 1.1.2
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 +8 -8
- data/lib/cql/protocol.rb +1 -1
- data/lib/cql/protocol/cql_protocol_handler.rb +8 -12
- data/lib/cql/protocol/responses/event_response.rb +9 -10
- data/lib/cql/protocol/responses/prepared_result_response.rb +4 -0
- data/lib/cql/protocol/responses/result_response.rb +9 -14
- data/lib/cql/protocol/responses/rows_result_response.rb +2 -0
- data/lib/cql/protocol/responses/{schema_change_event_result_response.rb → schema_change_event_response.rb} +4 -0
- data/lib/cql/protocol/responses/schema_change_result_response.rb +4 -0
- data/lib/cql/protocol/responses/set_keyspace_result_response.rb +4 -0
- data/lib/cql/protocol/responses/status_change_event_result_response.rb +4 -0
- data/lib/cql/protocol/responses/topology_change_event_result_response.rb +4 -0
- data/lib/cql/protocol/responses/void_result_response.rb +4 -0
- data/lib/cql/version.rb +1 -1
- data/spec/integration/client_spec.rb +2 -2
- data/spec/integration/protocol_spec.rb +0 -1
- data/spec/spec_helper.rb +1 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTJjMzQ5MTY0M2I5N2JjYzZmODFkODQwNzY3ZmE2MmU1MGZjZGUzMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2I0MjdmODYxOTM0YjgwODFjNThhZDJmOWFlMzdiNDdjYjJmODBmNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzE0MWU4ZTUxYmNjOGFkMDc0MzE1YTgxMGEyN2YzMzY2NDYzYTJjZTYxNDM5
|
10
|
+
ZTU3NGJiY2MxYjAyZjBjOWU3NmM1NmNiMDU2ZmI0YWYxMDUyOGI5OTQ1M2Zi
|
11
|
+
YzBkZmRmODIyMTUyZTUxMGM3MTk5YTg4MDE3YTZhODAxY2U4MjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmMwYTY2NTU3MGZhMjMyOTk0NjhkZjRmMTA2YmU2MTVhNzYxMmRhZDkzNmU2
|
14
|
+
NWNiOTY1YmYzYjlkOGZlMTkyMDdkMzJiMjQyMzY1ZDFkNGI3ZDE4OTUyNzFj
|
15
|
+
ZTgyZWU0YzA3OTVmOWQwYjEzMDgwZTRmNmM2NDgxMjQwNDc2MTA=
|
data/lib/cql/protocol.rb
CHANGED
@@ -54,7 +54,7 @@ require 'cql/protocol/responses/set_keyspace_result_response'
|
|
54
54
|
require 'cql/protocol/responses/prepared_result_response'
|
55
55
|
require 'cql/protocol/responses/schema_change_result_response'
|
56
56
|
require 'cql/protocol/responses/event_response'
|
57
|
-
require 'cql/protocol/responses/
|
57
|
+
require 'cql/protocol/responses/schema_change_event_response'
|
58
58
|
require 'cql/protocol/responses/status_change_event_result_response'
|
59
59
|
require 'cql/protocol/responses/topology_change_event_result_response'
|
60
60
|
require 'cql/protocol/request'
|
@@ -245,22 +245,18 @@ module Cql
|
|
245
245
|
|
246
246
|
def socket_closed(cause)
|
247
247
|
request_failure_cause = cause || Io::ConnectionClosedError.new
|
248
|
+
promises_to_fail = nil
|
248
249
|
@lock.synchronize do
|
249
|
-
@promises.
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
end
|
254
|
-
end
|
255
|
-
@request_queue_in.each do |promise|
|
256
|
-
promise.fail(request_failure_cause)
|
257
|
-
end
|
250
|
+
promises_to_fail = @promises.compact
|
251
|
+
promises_to_fail.concat(@request_queue_in)
|
252
|
+
promises_to_fail.concat(@request_queue_out)
|
253
|
+
@promises.fill(nil)
|
258
254
|
@request_queue_in.clear
|
259
|
-
@request_queue_out.each do |promise|
|
260
|
-
promise.fail(request_failure_cause)
|
261
|
-
end
|
262
255
|
@request_queue_out.clear
|
263
256
|
end
|
257
|
+
promises_to_fail.each do |promise|
|
258
|
+
promise.fail(request_failure_cause)
|
259
|
+
end
|
264
260
|
if cause
|
265
261
|
@closed_promise.fail(cause)
|
266
262
|
else
|
@@ -5,17 +5,16 @@ module Cql
|
|
5
5
|
class EventResponse < ResultResponse
|
6
6
|
def self.decode!(buffer)
|
7
7
|
type = read_string!(buffer)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
when StatusChangeEventResponse::TYPE
|
12
|
-
StatusChangeEventResponse.decode!(buffer)
|
13
|
-
when TopologyChangeEventResponse::TYPE
|
14
|
-
TopologyChangeEventResponse.decode!(buffer)
|
15
|
-
else
|
16
|
-
raise UnsupportedEventTypeError, %(Unsupported event type: "#{type}")
|
17
|
-
end
|
8
|
+
impl = EVENT_TYPES[type]
|
9
|
+
raise UnsupportedEventTypeError, %(Unsupported event type: "#{type}") unless impl
|
10
|
+
impl.decode!(buffer)
|
18
11
|
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
EVENT_TYPES = {
|
16
|
+
# populated by subclasses
|
17
|
+
}
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
@@ -5,25 +5,20 @@ module Cql
|
|
5
5
|
class ResultResponse < Response
|
6
6
|
def self.decode!(buffer)
|
7
7
|
kind = read_int!(buffer)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
when 0x02
|
12
|
-
RowsResultResponse.decode!(buffer)
|
13
|
-
when 0x03
|
14
|
-
SetKeyspaceResultResponse.decode!(buffer)
|
15
|
-
when 0x04
|
16
|
-
PreparedResultResponse.decode!(buffer)
|
17
|
-
when 0x05
|
18
|
-
SchemaChangeResultResponse.decode!(buffer)
|
19
|
-
else
|
20
|
-
raise UnsupportedResultKindError, %(Unsupported result kind: #{kind})
|
21
|
-
end
|
8
|
+
impl = RESULT_TYPES[kind]
|
9
|
+
raise UnsupportedResultKindError, %(Unsupported result kind: #{kind}) unless impl
|
10
|
+
impl.decode!(buffer)
|
22
11
|
end
|
23
12
|
|
24
13
|
def void?
|
25
14
|
false
|
26
15
|
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
RESULT_TYPES = [
|
20
|
+
# populated by subclasses
|
21
|
+
]
|
27
22
|
end
|
28
23
|
end
|
29
24
|
end
|
data/lib/cql/version.rb
CHANGED
@@ -25,8 +25,8 @@ describe 'A CQL client' do
|
|
25
25
|
it 'knows which keyspace it\'s in' do
|
26
26
|
client.use('system')
|
27
27
|
client.keyspace.should == 'system'
|
28
|
-
client.use('
|
29
|
-
client.keyspace.should == '
|
28
|
+
client.use('system_traces')
|
29
|
+
client.keyspace.should == 'system_traces'
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'is not in a keyspace initially' do
|
@@ -142,7 +142,6 @@ describe 'Protocol parsing and communication' do
|
|
142
142
|
raw_execute_request(Cql::Protocol::StartupRequest.new)
|
143
143
|
response = raw_execute_request(Cql::Protocol::RegisterRequest.new('TOPOLOGY_CHANGE'))
|
144
144
|
response.code.should == 10
|
145
|
-
response.message.should include('needs authentication')
|
146
145
|
end
|
147
146
|
end
|
148
147
|
|
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,7 @@ require 'support/await_helper'
|
|
9
9
|
require 'support/fake_server'
|
10
10
|
require 'support/fake_io_reactor'
|
11
11
|
|
12
|
-
unless ENV['COVERAGE'] == 'no'
|
12
|
+
unless ENV['COVERAGE'] == 'no' || RUBY_ENGINE == 'rbx'
|
13
13
|
require 'coveralls'
|
14
14
|
require 'simplecov'
|
15
15
|
|
@@ -26,4 +26,3 @@ unless ENV['COVERAGE'] == 'no'
|
|
26
26
|
end
|
27
27
|
|
28
28
|
require 'cql'
|
29
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cql-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Hultberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A pure Ruby CQL3 driver for Cassandra
|
14
14
|
email:
|
@@ -57,7 +57,7 @@ files:
|
|
57
57
|
- lib/cql/protocol/responses/ready_response.rb
|
58
58
|
- lib/cql/protocol/responses/result_response.rb
|
59
59
|
- lib/cql/protocol/responses/rows_result_response.rb
|
60
|
-
- lib/cql/protocol/responses/
|
60
|
+
- lib/cql/protocol/responses/schema_change_event_response.rb
|
61
61
|
- lib/cql/protocol/responses/schema_change_result_response.rb
|
62
62
|
- lib/cql/protocol/responses/set_keyspace_result_response.rb
|
63
63
|
- lib/cql/protocol/responses/status_change_event_result_response.rb
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.1.
|
133
|
+
rubygems_version: 2.1.11
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Cassandra CQL3 driver
|