mixed_gauge 0.1.4 → 0.2.0

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: 1287ac868f8d04e5a084973b66d9cb3592ec1658
4
- data.tar.gz: 096992dc8eb46a2fb67bd6cfad16ce348ce3ae27
3
+ metadata.gz: 710c53d91da41c8135d1fe2b2a0d2a90c5af4ffb
4
+ data.tar.gz: 29123eafebf6b4056bdbe40eb6dfa207abbb89b9
5
5
  SHA512:
6
- metadata.gz: a0d19dc2806f36b88c851da29e77eefa0f63466ff320a2c246c9801b7f60ee80161dedd7c5b20ae9bd8fc46ec1f619c688c2a58019091aa99f0803341bbf5fa8
7
- data.tar.gz: fb370f43a0a9231fac9b35009460b53917cb86fb89c70b58e6511ced16268eeed8392580cc271133170adacd0bd5c9e4a913982cc95810d0cebf7b94045ea0fe
6
+ metadata.gz: 5db5f80874c5e47b0da03c4929cbaec2a77fb7327fb2de0463437e2c5004e651a4a1d95a363f1e708a81a0579880602920d6399c5a08e74e41b0fe495d09f84c
7
+ data.tar.gz: 5c1160538e29b86d50efd84e76cb8bfe6781ada302c7ca2c7de55e29873f2e3d91661f33bef542d8b27ba632eeca2f4065d44deb058331c45cd58f7909c820f2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG for mixed_gauge
2
2
 
3
+ ## 0.2.0
4
+ - Replace default hash function from MD5 to CRC32. CRC32 is more distributed
5
+ for random data and more speedy than MD5.
6
+
3
7
  ## 0.1.4
4
8
  - Support executing queries in parallel.
5
9
 
data/lib/mixed_gauge.rb CHANGED
@@ -17,6 +17,7 @@ module MixedGauge
17
17
  @config ||= Config.new
18
18
  end
19
19
 
20
+ # @yield [MixedGauge::Config]
20
21
  def configure(&block)
21
22
  config.instance_eval(&block)
22
23
  end
@@ -10,18 +10,14 @@ module MixedGauge
10
10
  end
11
11
 
12
12
  # @param [Range] slots
13
- # @return [nil]
14
13
  def define_slots(slots)
15
14
  @slots = slots
16
- nil
17
15
  end
18
16
 
19
17
  # @param [Range] slots
20
18
  # @param [Symbol] connection connection name
21
- # @return [nil]
22
19
  def register(slots, connection)
23
20
  @connection_registry[slots] = connection
24
- nil
25
21
  end
26
22
 
27
23
  def validate_config!
@@ -1,6 +1,8 @@
1
+ require 'zlib'
2
+
1
3
  module MixedGauge
2
4
  class Config
3
- DEFAULT_HASH_FUNCTION = -> (key) { Digest::MD5.hexdigest(key).to_i(16) }
5
+ DEFAULT_HASH_FUNCTION = -> (key) { Zlib.crc32(key) }
4
6
 
5
7
  attr_reader :hash_proc, :cluster_configs
6
8
 
@@ -11,7 +13,7 @@ module MixedGauge
11
13
 
12
14
  # Define config for specific cluster.
13
15
  # @param [Symbol] cluster_name
14
- # @return [nil]
16
+ # @yield [MixedGauge::ClusterConfig]
15
17
  # @example
16
18
  # config.define_cluster(:user) do |cluster|
17
19
  # cluster.define_slots(1..1048576)
@@ -22,7 +24,6 @@ module MixedGauge
22
24
  cluster_config = ClusterConfig.new(cluster_name)
23
25
  cluster_config.instance_eval(&block)
24
26
  @cluster_configs[cluster_name] = cluster_config
25
- nil
26
27
  end
27
28
 
28
29
  # @param [Symbol] cluster_name
@@ -1,3 +1,3 @@
1
1
  module MixedGauge
2
- VERSION = '0.1.4'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixed_gauge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taiki Ono