clickhouse 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9430c069f56f33af1e4e54bcad89cf33fd836051
4
- data.tar.gz: a708443dd04408661f84e897e0cec49777188330
3
+ metadata.gz: 0ffb93716a6e9932f89d7d1942539402df85d1b0
4
+ data.tar.gz: 990fff529eb352d62076b01a2650a62242c9fb07
5
5
  SHA512:
6
- metadata.gz: 4b99166f3cbe200af3337764a0db939432094168d52cd2ba0f6526ef43fc5778e60030bbb49e7e877def07b5c0670df71a2c548488135a5a7613a2e7510884c8
7
- data.tar.gz: a71ad741943715b618bfae02fa34874074b4a72c3b9814c2a38c48bb5fae184b77a9367aa6976d6ca68312397112db11a28bbf3fee4573443839bec5c05fafca
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.3
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.connection
41
- @connection if instance_variables.include?(:@connection)
40
+ def self.connect!(config)
41
+ @connection = connect(config)
42
+ @connection.connect!
42
43
  end
43
44
 
44
- # private
45
-
46
- def self.connect!(config)
45
+ def self.connect(config)
47
46
  klass = (config[:urls] || config["urls"]) ? Cluster : Connection
48
- @connection = klass.new(config)
49
- @connection.connect!
47
+ klass.new(config)
50
48
  end
51
49
 
52
- private_class_method :connect!
50
+ def self.connection
51
+ @connection if instance_variables.include?(:@connection)
52
+ end
53
53
 
54
54
  end
@@ -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))
@@ -1,7 +1,7 @@
1
1
  module Clickhouse
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 3
4
+ TINY = 4
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
@@ -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.3
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-21 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday