data_fabric 1.3.1 → 1.3.2

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.
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
1
  DataFabric changelog
2
2
 
3
+ v1.3.2 - 2011-06-02
4
+
5
+ - Fix problem fetching spec for connection pool.
6
+ - Fix issues with Rails 3.1.
7
+
3
8
  v1.3.1 - 2011-02-10
4
9
 
5
10
  - Add some missing ConnectionPool methods (e.g. clear_reloadable_connections!)
data/README.rdoc CHANGED
@@ -25,7 +25,7 @@ or add data_fabric to your Gemfile:
25
25
 
26
26
  gem 'data_fabric'
27
27
 
28
- data_fabric has been tested with Rails 2.3.10, 3.0.0 and 3.0.3.
28
+ data_fabric has been tested with Rails 2.3.10 and 3.0.7.
29
29
 
30
30
  == How does it work?
31
31
 
@@ -28,7 +28,7 @@ module DataFabric
28
28
  end
29
29
 
30
30
  def spec
31
- @proxy.spec
31
+ @proxy.current_pool.spec
32
32
  end
33
33
 
34
34
  def with_connection
@@ -46,11 +46,21 @@ module DataFabric
46
46
  end
47
47
  end
48
48
  end
49
+
50
+ %w(columns columns_hash table_exists? primary_keys).each do |name|
51
+ define_method(name.to_sym) do |*args|
52
+ @proxy.current_pool.send(name.to_sym, *args)
53
+ end
54
+ end
55
+
56
+ def method_missing(name, *args)
57
+ DataFabric.logger.warn "Add '#{name}' to DataFabric::PoolProxy for performance"
58
+ @proxy.current_pool.send(name, *args)
59
+ end
49
60
  end
50
61
 
51
62
  class ConnectionProxy
52
63
  cattr_accessor :shard_pools
53
- attr_accessor :spec
54
64
 
55
65
  def initialize(model_class, options)
56
66
  @model_class = model_class
@@ -105,12 +115,6 @@ module DataFabric
105
115
  current_pool.connection
106
116
  end
107
117
 
108
- private
109
-
110
- def in_transaction?
111
- current_role == 'master'
112
- end
113
-
114
118
  def current_pool
115
119
  name = connection_name
116
120
  self.class.shard_pools[name] ||= begin
@@ -120,12 +124,18 @@ module DataFabric
120
124
  end
121
125
  end
122
126
 
127
+ private
128
+
129
+ def in_transaction?
130
+ current_role == 'master'
131
+ end
132
+
123
133
  def spec_for(config)
124
134
  # XXX This looks pretty fragile. Will break if AR changes how it initializes connections and adapters.
125
135
  config = config.symbolize_keys
126
136
  adapter_method = "#{config[:adapter]}_connection"
127
137
  initialize_adapter(config[:adapter])
128
- @spec = ActiveRecord::Base::ConnectionSpecification.new(config, adapter_method)
138
+ ActiveRecord::Base::ConnectionSpecification.new(config, adapter_method)
129
139
  end
130
140
 
131
141
  def initialize_adapter(adapter)
@@ -1,5 +1,5 @@
1
1
  module DataFabric
2
2
  module Version
3
- STRING = '1.3.1'
3
+ STRING = '1.3.2'
4
4
  end
5
5
  end
@@ -0,0 +1,203 @@
1
+ !RBIX
2
+ 17831730954501249321
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 28
13
+ 99
14
+ 7
15
+ 0
16
+ 65
17
+ 49
18
+ 1
19
+ 2
20
+ 13
21
+ 99
22
+ 12
23
+ 7
24
+ 2
25
+ 12
26
+ 7
27
+ 3
28
+ 12
29
+ 65
30
+ 12
31
+ 49
32
+ 4
33
+ 4
34
+ 15
35
+ 49
36
+ 2
37
+ 0
38
+ 15
39
+ 2
40
+ 11
41
+ I
42
+ 6
43
+ I
44
+ 0
45
+ I
46
+ 0
47
+ I
48
+ 0
49
+ n
50
+ p
51
+ 5
52
+ x
53
+ 10
54
+ DataFabric
55
+ x
56
+ 11
57
+ open_module
58
+ x
59
+ 15
60
+ __module_init__
61
+ M
62
+ 1
63
+ n
64
+ n
65
+ x
66
+ 10
67
+ DataFabric
68
+ i
69
+ 28
70
+ 5
71
+ 66
72
+ 99
73
+ 7
74
+ 0
75
+ 65
76
+ 49
77
+ 1
78
+ 2
79
+ 13
80
+ 99
81
+ 12
82
+ 7
83
+ 2
84
+ 12
85
+ 7
86
+ 3
87
+ 12
88
+ 65
89
+ 12
90
+ 49
91
+ 4
92
+ 4
93
+ 15
94
+ 49
95
+ 2
96
+ 0
97
+ 11
98
+ I
99
+ 6
100
+ I
101
+ 0
102
+ I
103
+ 0
104
+ I
105
+ 0
106
+ n
107
+ p
108
+ 5
109
+ x
110
+ 7
111
+ Version
112
+ x
113
+ 11
114
+ open_module
115
+ x
116
+ 15
117
+ __module_init__
118
+ M
119
+ 1
120
+ n
121
+ n
122
+ x
123
+ 7
124
+ Version
125
+ i
126
+ 12
127
+ 5
128
+ 66
129
+ 65
130
+ 7
131
+ 0
132
+ 7
133
+ 1
134
+ 64
135
+ 49
136
+ 2
137
+ 2
138
+ 11
139
+ I
140
+ 3
141
+ I
142
+ 0
143
+ I
144
+ 0
145
+ I
146
+ 0
147
+ n
148
+ p
149
+ 3
150
+ x
151
+ 6
152
+ STRING
153
+ s
154
+ 5
155
+ 1.3.1
156
+ x
157
+ 9
158
+ const_set
159
+ p
160
+ 3
161
+ I
162
+ 2
163
+ I
164
+ 3
165
+ I
166
+ c
167
+ x
168
+ 61
169
+ /Users/mperham/src/git/data_fabric/lib/data_fabric/version.rb
170
+ p
171
+ 0
172
+ x
173
+ 13
174
+ attach_method
175
+ p
176
+ 3
177
+ I
178
+ 2
179
+ I
180
+ 2
181
+ I
182
+ 1c
183
+ x
184
+ 61
185
+ /Users/mperham/src/git/data_fabric/lib/data_fabric/version.rb
186
+ p
187
+ 0
188
+ x
189
+ 13
190
+ attach_method
191
+ p
192
+ 3
193
+ I
194
+ 0
195
+ I
196
+ 1
197
+ I
198
+ 1c
199
+ x
200
+ 61
201
+ /Users/mperham/src/git/data_fabric/lib/data_fabric/version.rb
202
+ p
203
+ 0
@@ -37,6 +37,9 @@ class AdapterMock < ActiveRecord::ConnectionAdapters::AbstractAdapter
37
37
  def table_exists?(name)
38
38
  true
39
39
  end
40
+ def last_inserted_id(result)
41
+ 1
42
+ end
40
43
  def method_missing(name, *args)
41
44
  raise ArgumentError, "#{self.class.name} missing '#{name}': #{args.inspect}"
42
45
  end
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_fabric
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 3
8
- - 1
9
- version: 1.3.1
4
+ prerelease:
5
+ version: 1.3.2
10
6
  platform: ruby
11
7
  authors:
12
8
  - Mike Perham
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-02-10 00:00:00 -08:00
18
- default_executable:
13
+ date: 2011-06-03 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: flexmock
@@ -25,8 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
23
  version: "0"
31
24
  type: :development
32
25
  version_requirements: *id001
@@ -38,12 +31,10 @@ dependencies:
38
31
  requirements:
39
32
  - - ">="
40
33
  - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
34
  version: "0"
44
35
  type: :development
45
36
  version_requirements: *id002
46
- description: Sharding and replication support for ActiveRecord 2.x
37
+ description: Sharding and replication support for ActiveRecord
47
38
  email: mperham@gmail.com
48
39
  executables: []
49
40
 
@@ -55,6 +46,7 @@ files:
55
46
  - lib/data_fabric/connection_proxy.rb
56
47
  - lib/data_fabric/extensions.rb
57
48
  - lib/data_fabric/version.rb
49
+ - lib/data_fabric/version.rbc
58
50
  - lib/data_fabric.rb
59
51
  - example23/app/controllers/accounts_controller.rb
60
52
  - example23/app/controllers/application_controller.rb
@@ -158,7 +150,6 @@ files:
158
150
  - test/vr_austin_slave.db
159
151
  - test/vr_dallas_master.db
160
152
  - test/vr_dallas_slave.db
161
- has_rdoc: true
162
153
  homepage: http://github.com/mperham/data_fabric
163
154
  licenses: []
164
155
 
@@ -172,24 +163,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
163
  requirements:
173
164
  - - ">="
174
165
  - !ruby/object:Gem::Version
175
- segments:
176
- - 0
177
166
  version: "0"
178
167
  required_rubygems_version: !ruby/object:Gem::Requirement
179
168
  none: false
180
169
  requirements:
181
170
  - - ">="
182
171
  - !ruby/object:Gem::Version
183
- segments:
184
- - 0
185
172
  version: "0"
186
173
  requirements: []
187
174
 
188
175
  rubyforge_project:
189
- rubygems_version: 1.3.7
176
+ rubygems_version: 1.7.2
190
177
  signing_key:
191
178
  specification_version: 3
192
- summary: Sharding and replication support for ActiveRecord 2.x
179
+ summary: Sharding and replication support for ActiveRecord
193
180
  test_files:
194
181
  - test/connection_test.rb
195
182
  - test/database.yml