master_slave_adapter_tcurdt 0.0.5 → 0.0.6
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/lib/master_slave_adapter/adapter.rb +7 -9
- data/lib/master_slave_adapter/version.rb +1 -1
- data/specs/specs.rb +4 -4
- metadata +3 -3
@@ -151,12 +151,10 @@ module ActiveRecord
|
|
151
151
|
result
|
152
152
|
end
|
153
153
|
|
154
|
-
def transaction(
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
update_clock
|
159
|
-
result
|
154
|
+
def transaction(options = {}, &block)
|
155
|
+
on_write do
|
156
|
+
self.master_connection.transaction(options, &block)
|
157
|
+
end
|
160
158
|
end
|
161
159
|
|
162
160
|
class << self
|
@@ -169,8 +167,8 @@ module ActiveRecord
|
|
169
167
|
ActiveRecord::Base.with_slave(&block)
|
170
168
|
end
|
171
169
|
|
172
|
-
def
|
173
|
-
ActiveRecord::Base.
|
170
|
+
def with_consistency(clock, &block)
|
171
|
+
ActiveRecord::Base.with_consistency(clock, &block)
|
174
172
|
end
|
175
173
|
|
176
174
|
def reset!
|
@@ -283,4 +281,4 @@ module ActiveRecord
|
|
283
281
|
|
284
282
|
end
|
285
283
|
end
|
286
|
-
end
|
284
|
+
end
|
data/specs/specs.rb
CHANGED
@@ -329,11 +329,11 @@ describe ActiveRecord::ConnectionAdapters::MasterSlaveAdapter do
|
|
329
329
|
it "should update the clock after a transaction" do
|
330
330
|
ActiveRecord::ConnectionAdapters::MasterSlaveAdapter.reset!
|
331
331
|
slave_should_report_clock(0)
|
332
|
-
master_should_report_clock([0, 1, 1
|
332
|
+
master_should_report_clock([0, 1, 1])
|
333
333
|
@slave_connection.should_receive('select_all').exactly(1).times.with('testing').and_return(true)
|
334
|
-
@master_connection.should_receive('update').exactly(
|
335
|
-
|
336
|
-
@master_connection.should_receive('select_all').exactly(
|
334
|
+
@master_connection.should_receive('update').exactly(2).times.with('testing').and_return(true)
|
335
|
+
@master_connection.should_receive('transaction').and_return(true)
|
336
|
+
@master_connection.should_receive('select_all').exactly(3).times.with('testing').and_return(true)
|
337
337
|
|
338
338
|
old_clock = zero
|
339
339
|
new_clock = ActiveRecord::Base.with_consistency(old_clock) do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mauricio Linhares
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-07 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|