activerecord-shard_for 0.1.1 → 0.1.2

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: 22921dabf9395f774844eaf741cb9c816956b963
4
- data.tar.gz: a114b4ea4d194b3a987ef690c0b95e0ab9b04bd8
3
+ metadata.gz: a145bb643f713e31825e2bf87446c2657d10a1a4
4
+ data.tar.gz: 01eedb436a6b730078c624cf539fb5cd402c9495
5
5
  SHA512:
6
- metadata.gz: e2c86ba9ac6f28653530dfcba1d2d0130f143db28593b1f06d5554e53b88bc435dbea9b136d0bdc04144ae3e01adb4992426a35e33db343515549d3351118a17
7
- data.tar.gz: 9f612bdfd711cc935c12be868e38a29f2c9ff5b13dfeda6b85d7e94bddc053edad093c38f498942a79712b2cbe6bd9859fca66add24554685a3ede1659993fbc
6
+ metadata.gz: 7c642c62650b872380169af15830b0c96c772f6aaf90bfa74340bb8e499eb794a90f5f905cc4fc74c8414189ee7faffa894a576baffac8085d26d01d56a4704e
7
+ data.tar.gz: 338d2512639fc8ababdad1d3b8f4afb4d1915026adc5d65622662be63237b6449b7d3cd4f546384461ef11c1bc3e881f7d8b1c879c10b3d024652930350fde3b
@@ -5,7 +5,7 @@ module ActiveRecord
5
5
 
6
6
  def initialize
7
7
  @cluster_configs = {}
8
- @routers = {}
8
+ @connection_routers = {}
9
9
  end
10
10
 
11
11
  # Define config for specific cluster.
@@ -37,7 +37,7 @@ module ActiveRecord
37
37
 
38
38
  # @param [Symbol] router_name
39
39
  # @return [Class] registered class by [#register_router]
40
- def fetch_connection__router(router_name)
40
+ def fetch_connection_router(router_name)
41
41
  connection_routers[router_name]
42
42
  end
43
43
  end
@@ -6,7 +6,7 @@ module ActiveRecord
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
- class_attribute :cluster_router, instance_writer: false
9
+ class_attribute :connection_router, instance_writer: false
10
10
  class_attribute :shard_repository, instance_writer: false
11
11
  class_attribute :replication_mapping, instance_writer: false
12
12
  class_attribute :distkey, instance_writer: false
@@ -17,8 +17,8 @@ module ActiveRecord
17
17
  # @param [Symbol] name A cluster name which is set by ActiveRecord::ShardFor.configure
18
18
  def use_cluster(name, router_name)
19
19
  cluster_config = ActiveRecord::ShardFor.config.fetch_cluster_config(name)
20
- cluster_router_class = ActiveRecord::ShardFor.config.fetch_cluster_router(router_name)
21
- self.cluster_router = cluster_router_class.new(cluster_config)
20
+ connection_router_class = ActiveRecord::ShardFor.config.fetch_connection_router(router_name)
21
+ self.connection_router = connection_router_class.new(cluster_config)
22
22
  self.shard_repository = ActiveRecord::ShardFor::ShardRepogitory.new(cluster_config, self)
23
23
  self.abstract_class = true
24
24
  end
@@ -28,7 +28,7 @@ module ActiveRecord
28
28
  # @param [String] key A value of distkey
29
29
  # @return [Class] A generated model class for given distkey value
30
30
  def shard_for(key)
31
- connection_name = cluster_router.fetch_connection_name(key)
31
+ connection_name = connection_router.fetch_connection_name(key)
32
32
  shard_repository.fetch(connection_name)
33
33
  end
34
34
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module ShardFor
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ require 'activerecord/shard_for/config'
5
5
  require 'activerecord/shard_for/cluster_config'
6
6
  require 'activerecord/shard_for/model'
7
7
  require 'activerecord/shard_for/errors'
8
- require 'activerecord/shard_for/cluster_router'
8
+ require 'activerecord/shard_for/connection_router'
9
9
  require 'activerecord/shard_for/hash_modulo_router'
10
10
  require 'activerecord/shard_for/database_tasks'
11
11
  require 'activerecord/shard_for/shard_repogitory'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-shard_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuemori