activerecord-shard_for 0.1.0 → 0.1.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22921dabf9395f774844eaf741cb9c816956b963
|
|
4
|
+
data.tar.gz: a114b4ea4d194b3a987ef690c0b95e0ab9b04bd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e2c86ba9ac6f28653530dfcba1d2d0130f143db28593b1f06d5554e53b88bc435dbea9b136d0bdc04144ae3e01adb4992426a35e33db343515549d3351118a17
|
|
7
|
+
data.tar.gz: 9f612bdfd711cc935c12be868e38a29f2c9ff5b13dfeda6b85d7e94bddc053edad093c38f498942a79712b2cbe6bd9859fca66add24554685a3ede1659993fbc
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module ActiveRecord
|
|
2
2
|
module ShardFor
|
|
3
3
|
class Config
|
|
4
|
-
attr_reader :cluster_configs, :
|
|
4
|
+
attr_reader :cluster_configs, :connection_routers
|
|
5
5
|
|
|
6
6
|
def initialize
|
|
7
7
|
@cluster_configs = {}
|
|
@@ -27,18 +27,18 @@ module ActiveRecord
|
|
|
27
27
|
cluster_configs.fetch(cluster_name)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
# Register router for ActiveRecord::ShardFor
|
|
30
|
+
# Register connection router for ActiveRecord::ShardFor
|
|
31
31
|
# See README.md for example.
|
|
32
32
|
# @param [Symbol] router_name
|
|
33
33
|
# @router_class [Class] router_class
|
|
34
|
-
def
|
|
35
|
-
|
|
34
|
+
def register_connection_router(router_name, router_class)
|
|
35
|
+
connection_routers[router_name] = router_class
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
# @param [Symbol] router_name
|
|
39
39
|
# @return [Class] registered class by [#register_router]
|
|
40
|
-
def
|
|
41
|
-
|
|
40
|
+
def fetch_connection__router(router_name)
|
|
41
|
+
connection_routers[router_name]
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|