clickhouse 0.1.3 → 0.1.4
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/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/clickhouse.rb +8 -8
- data/lib/clickhouse/cluster.rb +2 -1
- data/lib/clickhouse/version.rb +1 -1
- data/test/unit/connection/test_cluster.rb +6 -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: 0ffb93716a6e9932f89d7d1942539402df85d1b0
|
4
|
+
data.tar.gz: 990fff529eb352d62076b01a2650a62242c9fb07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bca9c9ae26b8066ad10aae19b84b2c6c2c984125a7f9ed53299ff15b5ee9e1cec3cb4cef1733abb8515f51ee8a33f0dec61d9a03d7da36807f7935f980f9b761
|
7
|
+
data.tar.gz: e819b57c54e604df2810d7e2c7e55ae5c18087c959581dda41ebc378310f9d0365e31020e9ad35798413356b6a12be71fc3969fd9ab62a5307be73058c21ba30
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## Clickhouse CHANGELOG
|
2
2
|
|
3
|
+
### Version 0.1.4 (October 25, 2016)
|
4
|
+
|
5
|
+
* Ensured that Clickhouse does not modify the passed cluster config
|
6
|
+
* Introduced Clickhouse#connect which returns either a cluster or connection without memoizing it as Clickhouse#connection
|
7
|
+
|
3
8
|
### Version 0.1.3 (October 21, 2016)
|
4
9
|
|
5
10
|
* Only removing connections from cluster connection pool after a Clickhouse::ConnectionError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/clickhouse.rb
CHANGED
@@ -37,18 +37,18 @@ module Clickhouse
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.
|
41
|
-
@connection
|
40
|
+
def self.connect!(config)
|
41
|
+
@connection = connect(config)
|
42
|
+
@connection.connect!
|
42
43
|
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
def self.connect!(config)
|
45
|
+
def self.connect(config)
|
47
46
|
klass = (config[:urls] || config["urls"]) ? Cluster : Connection
|
48
|
-
|
49
|
-
@connection.connect!
|
47
|
+
klass.new(config)
|
50
48
|
end
|
51
49
|
|
52
|
-
|
50
|
+
def self.connection
|
51
|
+
@connection if instance_variables.include?(:@connection)
|
52
|
+
end
|
53
53
|
|
54
54
|
end
|
data/lib/clickhouse/cluster.rb
CHANGED
@@ -4,9 +4,10 @@ module Clickhouse
|
|
4
4
|
attr_reader :pond
|
5
5
|
|
6
6
|
def initialize(config)
|
7
|
+
config = config.dup
|
7
8
|
urls = config.delete(:urls) || config.delete("urls")
|
8
|
-
@pond = ::Pond.new :maximum_size => urls.size, :timeout => 0.1
|
9
9
|
|
10
|
+
@pond = ::Pond.new :maximum_size => urls.size, :timeout => 0.1
|
10
11
|
block = ::Proc.new do
|
11
12
|
url = (urls - pond.available.collect(&:url)).first || urls.sample
|
12
13
|
::Clickhouse::Connection.new(config.merge(:url => url))
|
data/lib/clickhouse/version.rb
CHANGED
@@ -10,6 +10,12 @@ module Unit
|
|
10
10
|
assert_equal true, cluster.pond.is_a?(Pond)
|
11
11
|
end
|
12
12
|
|
13
|
+
it "does not modify the passed config" do
|
14
|
+
config = {:urls => %w(localhost:1234 localhost:1235 localhost:1236)}
|
15
|
+
Clickhouse::Cluster.new config
|
16
|
+
assert_equal({:urls => %w(localhost:1234 localhost:1235 localhost:1236)}, config)
|
17
|
+
end
|
18
|
+
|
13
19
|
describe "when connection succeeds" do
|
14
20
|
it "keeps valid connections from the pond" do
|
15
21
|
Clickhouse::Connection.any_instance.expects(:tables)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clickhouse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Engel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|