cassanity 0.6.0.beta1 → 0.6.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cassanity/client.rb +12 -1
- data/lib/cassanity/version.rb +1 -1
- data/spec/unit/cassanity/client_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aee509bb367d05f910d105796eeb15a6a9d3e3ec
|
4
|
+
data.tar.gz: f25ef46dc1e27af16144642fdf9e50e43a2a717e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a973ccb47b4a3e244ab33fcd4ca2bceffeada294ad865a92c6fb850065d5466de26a3067b01dd6328ca867c034040697d1f7c15bdf3af95b576c42a7c0b04c
|
7
|
+
data.tar.gz: 63750d81f4656e692606d9b81d4504341cccfa626d7a637a15446a1768327f52b2e8d846fedd35ef1bae81b5851b395b909e5905a7b443d818d7b1505199ad2c
|
data/lib/cassanity/client.rb
CHANGED
@@ -35,18 +35,29 @@ module Cassanity
|
|
35
35
|
@instrumenter = @options.delete(:instrumenter)
|
36
36
|
@retry_strategy = @options.delete(:retry_strategy)
|
37
37
|
|
38
|
+
connect
|
39
|
+
end
|
40
|
+
|
41
|
+
# Connect or reconnect to cassandra
|
42
|
+
def connect
|
43
|
+
disconnect
|
44
|
+
|
38
45
|
@driver = Cql::Client.connect(@options)
|
39
46
|
@executor = Cassanity::Executors::CqlRb.new({
|
40
47
|
driver: @driver,
|
41
48
|
instrumenter: @instrumenter,
|
42
49
|
retry_strategy: @retry_strategy,
|
43
50
|
})
|
44
|
-
|
45
51
|
@connection = Cassanity::Connection.new({
|
46
52
|
executor: @executor,
|
47
53
|
})
|
48
54
|
end
|
49
55
|
|
56
|
+
# Disconnect from cassandra.
|
57
|
+
def disconnect
|
58
|
+
@driver.close if @driver
|
59
|
+
end
|
60
|
+
|
50
61
|
# Methods on client that should be delegated to connection.
|
51
62
|
DelegateToConnectionMethods = [
|
52
63
|
:keyspaces,
|
data/lib/cassanity/version.rb
CHANGED
@@ -116,6 +116,15 @@ describe Cassanity::Client do
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
+
describe "#disconnect" do
|
120
|
+
it "allows the connection to be terminated" do
|
121
|
+
driver.should_receive(:close)
|
122
|
+
|
123
|
+
client = described_class.new
|
124
|
+
client.disconnect
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
119
128
|
describe "#inspect" do
|
120
129
|
it "return representation" do
|
121
130
|
result = subject.inspect
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassanity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0.
|
4
|
+
version: 0.6.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cql-rb
|