switch_point 0.5.0.pre → 0.9.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
- SHA1:
3
- metadata.gz: d937f9d15338cf8a36af264c6c5ff63c985edd11
4
- data.tar.gz: 77fb0385c14264cb283ed32f41493dde3aa2ec7a
2
+ SHA256:
3
+ metadata.gz: 2e3915fe82c56723bcc2ac31421b8158cadde91d89378ff5769c846cba2899fd
4
+ data.tar.gz: c98d107a1108cbacb334823219e06d14cfafdc24ba9f4dc821f479d96b531987
5
5
  SHA512:
6
- metadata.gz: 3dfd6368a9967952b2eb83770ae3e700fe2f2299965364d3ebdca23f986f14303fb565a54b71c32b459df632067dcad8dd941dc1c6d3bc4cd6f97dc95fd3b1f8
7
- data.tar.gz: 750d9ea20a474e5d453208dc95fef6df37fa3f6e4ce466a6d341a5ada8b6709a3797abbbef9e37340a1da03f8d9f0e640e55bb607d9cb06a37c6315850764551
6
+ metadata.gz: 2eec3b0ca5d8d22b5fb9f302c0c9b7dfa71409c7e1d49a8bca4d760eda64f4b9bb1d4779284fa3cccfdebee734aa2d67bb66de315519f461de6d98c983aa7365
7
+ data.tar.gz: 2ed6d067c24d5642f5e92267014563898c4212fc5c2e31c6cf892e5846979f53c33c139a9528762a3f5058272ad13ea294a60e6158e7ea247c20600156e7168b
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ /gemfiles/*.lock
@@ -0,0 +1,56 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.5
5
+ DisplayCopNames: true
6
+ NewCops: enable
7
+ Exclude:
8
+ - gemfiles/*.gemfile
9
+
10
+ Layout/ArgumentAlignment:
11
+ Enabled: false
12
+ Layout/LineLength:
13
+ Enabled: false
14
+ Layout/ParameterAlignment:
15
+ Enabled: false
16
+
17
+ Naming/FileName:
18
+ Exclude:
19
+ - Appraisals
20
+
21
+ Style/AccessModifierDeclarations:
22
+ Enabled: false
23
+ Style/Alias:
24
+ EnforcedStyle: prefer_alias_method
25
+ Style/BlockDelimiters:
26
+ Enabled: false
27
+ Style/GuardClause:
28
+ Enabled: false
29
+ Style/HashSyntax:
30
+ Exclude:
31
+ - Rakefile
32
+ Style/IfUnlessModifier:
33
+ Enabled: false
34
+ Style/Lambda:
35
+ Enabled: false
36
+ Style/Next:
37
+ Enabled: false
38
+ Style/PercentLiteralDelimiters:
39
+ PreferredDelimiters:
40
+ '%w': '[]'
41
+ Style/RaiseArgs:
42
+ EnforcedStyle: compact
43
+ Style/SafeNavigation:
44
+ Enabled: false
45
+ Style/SignalException:
46
+ Enabled: false
47
+ Style/SoleNestedConditional:
48
+ Enabled: false
49
+ Style/TrailingCommaInArguments:
50
+ Enabled: false
51
+ Style/TrailingCommaInArrayLiteral:
52
+ Enabled: false
53
+ Style/TrailingCommaInHashLiteral:
54
+ Enabled: false
55
+ Metrics:
56
+ Enabled: false
@@ -0,0 +1,2 @@
1
+ Style/Documentation:
2
+ Enabled: false
@@ -1,15 +1,30 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1
5
- - 2.2
3
+ - 2.5.8
4
+ - 2.6.6
5
+ - 2.7.2
6
6
  - ruby-head
7
7
  gemfile:
8
8
  - gemfiles/rails_3.2.gemfile
9
9
  - gemfiles/rails_4.0.gemfile
10
10
  - gemfiles/rails_4.1.gemfile
11
- - gemfiles/rails_edge.gemfile
12
- matrix:
11
+ - gemfiles/rails_4.2.gemfile
12
+ - gemfiles/rails_5.0.gemfile
13
+ - gemfiles/rails_5.1.gemfile
14
+ - gemfiles/rails_5.2.gemfile
15
+ - gemfiles/rails_6.0.gemfile
16
+ after_script:
17
+ - bundle exec rake benchmark
18
+ jobs:
13
19
  allow_failures:
14
20
  - rvm: ruby-head
15
- - gemfile: gemfiles/rails_edge.gemfile
21
+ exclude:
22
+ # Rails 3.2 - 4.2 doesn't support Ruby 2.7
23
+ - rvm: 2.7.2
24
+ gemfile: gemfiles/rails_3.2.gemfile
25
+ - rvm: 2.7.2
26
+ gemfile: gemfiles/rails_4.0.gemfile
27
+ - rvm: 2.7.2
28
+ gemfile: gemfiles/rails_4.1.gemfile
29
+ - rvm: 2.7.2
30
+ gemfile: gemfiles/rails_4.2.gemfile
data/Appraisals CHANGED
@@ -1,17 +1,67 @@
1
+ # frozen_string_literal: true
2
+
1
3
  appraise 'rails-3.2' do
2
- gem 'activerecord', '~> 3.2'
4
+ gem 'activerecord', '~> 3.2.0'
5
+
6
+ platforms :ruby do
7
+ gem 'sqlite3', '~> 1.3.5'
8
+ end
3
9
  end
4
10
 
5
11
  appraise 'rails-4.0' do
6
- gem 'activerecord', '~> 4.0'
12
+ gem 'activerecord', '~> 4.0.0'
13
+
14
+ platforms :ruby do
15
+ gem 'sqlite3', '~> 1.3.6'
16
+ end
7
17
  end
8
18
 
9
19
  appraise 'rails-4.1' do
10
- gem 'activerecord', '~> 4.1'
20
+ gem 'activerecord', '~> 4.1.0'
21
+
22
+ platforms :ruby do
23
+ gem 'sqlite3', '~> 1.3.6'
24
+ end
11
25
  end
12
26
 
13
- appraise 'rails-edge' do
14
- gem 'activerecord', git: 'https://github.com/rails/rails'
27
+ appraise 'rails-4.2' do
28
+ gem 'activerecord', '~> 4.2.0'
29
+
30
+ platforms :ruby do
31
+ gem 'sqlite3', '~> 1.3.6'
32
+ end
33
+ end
34
+
35
+ appraise 'rails-5.0' do
36
+ gem 'activerecord', '~> 5.0.0'
37
+
38
+ platforms :ruby do
39
+ gem 'sqlite3', '~> 1.3.6'
40
+ end
41
+ end
42
+
43
+ appraise 'rails-5.1' do
44
+ gem 'activerecord', '~> 5.1.0'
45
+
46
+ platforms :ruby do
47
+ gem 'sqlite3'
48
+ end
49
+ end
50
+
51
+ appraise 'rails-5.2' do
52
+ gem 'activerecord', '~> 5.2.0'
53
+
54
+ platforms :ruby do
55
+ gem 'sqlite3'
56
+ end
57
+ end
58
+
59
+ appraise 'rails-6.0' do
60
+ gem 'activerecord', '~> 6.0.0'
61
+
62
+ platforms :ruby do
63
+ gem 'sqlite3'
64
+ end
15
65
  end
16
66
 
17
67
  # vim: set ft=ruby:
@@ -1,4 +1,26 @@
1
- ## 0.5.0 (XXXX-XX-XX)
1
+ ## 0.9.0 (2020-11-22)
2
+ - Drop support for Ruby 2.2, 2.3 and 2.4
3
+ - End support for upcoming ActiveRecord >= v6.1
4
+
5
+ ## 0.8.0 (2016-06-06)
6
+ - Drop Ruby 2.0.0 and 2.1 support
7
+ - Add `AR::Base#with_readonly` and `AR::Base#with_writable`
8
+ - short-hand for `AR::Base.with_readonly` and `AR::Base.with_writable`
9
+ - Add `AR::Base#transaction_with`
10
+ - short-hand for `AR::Base.transaction_with`
11
+ - Fix warnings for Rails 5.0
12
+
13
+ ## 0.7.0 (2015-10-16)
14
+ - `Model.with_readonly` and `Model.with_writable` now raises error when the Model doesn't use switch_point
15
+
16
+ ## 0.6.0 (2015-04-14)
17
+ - Add `SwitchPoint::QueryCache` middleware
18
+ - `Model.cache` and `Model.uncached` is now hooked by switch_point
19
+ - `Model.cache` enables query cache for both readonly and writable.
20
+ - `Model.uncached` disables query cache for both readonly and writable.
21
+ - Add `SwitchPoint.with_readonly_all` and `SwitchPoint.with_writable_all` as shorthand
22
+
23
+ ## 0.5.0 (2014-11-05)
2
24
  - Rename `SwitchPoint.with_connection` to `SwitchPoint.with_mode`
3
25
  - To avoid confusion with `ActiveRecord::ConnectionPool#with_connection`
4
26
  - Inherit superclass' switch_point configuration
data/Gemfile CHANGED
@@ -1,4 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in switch_point.gemspec
4
6
  gemspec
7
+
8
+ platforms :ruby do
9
+ gem 'sqlite3'
10
+ end
data/README.md CHANGED
@@ -1,11 +1,28 @@
1
1
  # SwitchPoint
2
2
  [![Gem Version](https://badge.fury.io/rb/switch_point.svg)](http://badge.fury.io/rb/switch_point)
3
3
  [![Build Status](https://travis-ci.org/eagletmt/switch_point.svg?branch=master)](https://travis-ci.org/eagletmt/switch_point)
4
- [![Coverage Status](https://coveralls.io/repos/eagletmt/switch_point/badge.png?branch=master)](https://coveralls.io/r/eagletmt/switch_point?branch=master)
5
- [![Code Climate](https://codeclimate.com/github/eagletmt/switch_point.png)](https://codeclimate.com/github/eagletmt/switch_point)
4
+ [![Coverage Status](https://img.shields.io/coveralls/eagletmt/switch_point.svg?branch=master)](https://coveralls.io/r/eagletmt/switch_point?branch=master)
5
+ [![Code Climate](https://codeclimate.com/github/eagletmt/switch_point/badges/gpa.svg)](https://codeclimate.com/github/eagletmt/switch_point)
6
6
 
7
7
  Switching database connection between readonly one and writable one.
8
8
 
9
+ ## Maintenance notice
10
+ switch_point won't support upcoming ActiveRecord v6.1 or later.
11
+ Developers should use the builtin multiple database feature introduced in ActiveRecord v6.0.
12
+ https://guides.rubyonrails.org/active_record_multiple_databases.html
13
+ Thus the supported ActiveRecord version is v3.2, v4.0, v4.1, v4.2, v5.0, v5.1, and v5.2.
14
+
15
+ switch_point won't accept any new features. Bug fixes might be accepted.
16
+ If you'd like to add a new feature (and/or support ActiveRecord >= v6.1), feel free to fork switch_point gem.
17
+
18
+ ### Migration from switch_point to ActiveRecord multiple database feature
19
+ 1. Upgrade your activerecord gem to v6.0
20
+ - ActiveRecord v6.0 is the only series which supports both builtin multiple database feature and switch_point.
21
+ 2. Change your application to use ActiveRecord multiple database feature
22
+ - If you'd like to keep the number of connections during this step, it would require some tricks.
23
+ 3. Remove switch_point gem from your Gemfile
24
+ 4. Upgrade your activerecord gem to v6.1 or later
25
+
9
26
  ## Installation
10
27
 
11
28
  Add this line to your application's Gemfile:
@@ -89,6 +106,22 @@ end
89
106
 
90
107
  Note that Article and Category shares their connections.
91
108
 
109
+ ### Query cache
110
+ `Model.cache` and `Model.uncached` enables/disables query cache for both
111
+ readonly connection and writable connection.
112
+
113
+ switch_point also provide a rack middleware `SwitchPoint::QueryCache` similar
114
+ to `ActiveRecord::QueryCache`. It enables query cache for all models using
115
+ switch_point.
116
+
117
+ ```ruby
118
+ # Replace ActiveRecord::QueryCache with SwitchPoint::QueryCache
119
+ config.middleware.swap ActiveRecord::QueryCache, SwitchPoint::QueryCache
120
+
121
+ # Enable query cache for :nanika1 only.
122
+ config.middleware.swap ActiveRecord::QueryCache, SwitchPoint::QueryCache, [:nanika1]
123
+ ```
124
+
92
125
  ## Notes
93
126
 
94
127
  ### auto_writable
@@ -121,7 +154,7 @@ Each ActiveRecord model refers to a proxy.
121
154
 
122
155
  When the writable connection is requested to execute destructive query, the readonly connection clears its query cache.
123
156
 
124
- ![switch_point](http://gyazo.wanko.cc/switch_point.svg)
157
+ ![switch_point](https://gyazo.wanko.cc/switch_point.svg)
125
158
 
126
159
  ### Special case: ActiveRecord::Base.connection
127
160
  Basically, each connection managed by a proxy isn't shared between proxies.
data/Rakefile CHANGED
@@ -1,6 +1,16 @@
1
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
2
 
3
- task :default => :spec
3
+ require 'bundler/gem_tasks'
4
+
5
+ task :default => %i[spec rubocop]
4
6
 
5
7
  require 'rspec/core/rake_task'
6
8
  RSpec::Core::RakeTask.new(:spec)
9
+
10
+ require 'rubocop/rake_task'
11
+ RuboCop::RakeTask.new(:rubocop)
12
+
13
+ desc 'Run benchmark'
14
+ task :benchmark do
15
+ sh 'ruby', 'benchmark/proxy.rb'
16
+ end
@@ -1,2 +1,2 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <svg contentScriptType="text/ecmascript" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" contentStyleType="text/css" viewBox="74.0 85.0 534.0 434.1035" xmlns:cacoo="http://cacoo.com/" preserveAspectRatio="xMidYMin meet" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id4" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#e33933"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id5" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#e33933"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id6" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#97d077"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id7" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#97d077"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id15" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id16" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id17" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id26" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id27" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#e33933"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id28" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#74c14a"/></marker></defs><g><g transform="translate(529.0 140.8965)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L64.00000000000006 6.0 L64.00000000000006 52.5 Q64.00000000000006 54.98528137423857 54.62741699796954 56.742640687119284 Q45.25483399593911 58.5 32.00000000000002 58.5 Q18.745166004060973 58.5 9.372583002030485 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M64.00000000000006 6.0 Q64.00000000000006 8.485281374238571 54.62741699796954 10.242640687119284 Q45.25483399593911 11.999999999999998 32.00000000000003 12.0 Q18.745166004060973 12.0 9.372583002030488 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030485 1.7573593128807152 Q18.745166004060973 8.881784197001252E-16 32.00000000000002 0.0 Q45.25483399593911 -8.881784197001252E-16 54.62741699796954 1.7573593128807143 Q64.00000000000006 3.5147186257614287 64.00000000000006 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id0"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id0)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="19.25" textLength="28.0">main</tspan><tspan x="11.0" xml:space="preserve" y="36.25" textLength="41.0">master</tspan></text></g></g><g transform="translate(529.0 376.8965)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L63.99999999999992 6.0 L63.99999999999992 52.5 Q63.99999999999992 54.98528137423857 54.62741699796942 56.742640687119284 Q45.25483399593904 58.5 31.999999999999932 58.5 Q18.745166004060934 58.5 9.372583002030463 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M63.99999999999992 6.0 Q63.99999999999992 8.485281374238571 54.62741699796942 10.242640687119284 Q45.25483399593904 11.999999999999998 31.99999999999996 12.0 Q18.74516600406094 12.0 9.37258300203047 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030463 1.7573593128807152 Q18.745166004060934 8.881784197001252E-16 31.999999999999932 0.0 Q45.25483399593904 -8.881784197001252E-16 54.62741699796942 1.7573593128807143 Q63.99999999999992 3.5147186257614287 63.99999999999992 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id1"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id1)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="9.0" xml:space="preserve" y="19.25" textLength="46.0">commet</tspan><tspan x="11.0" xml:space="preserve" y="36.25" textLength="41.0">master</tspan></text></g></g><g transform="translate(293.5289580126552 170.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M51.74956447969533 68.4248898947933 L0.424969148024419 34.35350099488455 L51.74956447969533 0.28211209497580036 L103.07415981136624 34.35350099488455 L51.74956447969533 68.4248898947933 L51.74956447969533 68.4248898947933z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(20.199307221852635 21.163783014064215)"><clipPath id="id2"><path d="M0 0 L62.58726465655704 0 L62.58726465655704 26.463928188151897 L0 26.463928188151897z"/></clipPath><text font-size="12" clip-path="url(#id2)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="17.0" xml:space="preserve" y="17.73196409407595" textLength="28.0">main</tspan></text></g></g><g transform="translate(293.5289580126552 406.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M51.381583974689526 68.70699999999998 L7.148564543362447E-16 34.35349999999998 L51.381583974689526 -5.911707234851347E-15 L102.76316794937905 34.35349999999998 L51.381583974689526 68.70699999999998 L51.381583974689526 68.70699999999998z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(19.79629465597243 21.054571154298447)"><clipPath id="id3"><path d="M0 0 L62.65675888753867 0 L62.65675888753867 26.683049513549793 L0 26.683049513549793z"/></clipPath><text font-size="12" clip-path="url(#id3)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="5.0" xml:space="preserve" y="17.841524756774895" textLength="53.0">comment</tspan></text></g></g><path fill="none" marker-end="url(#id4)" d="M370.94082015818594 187.46430654493017 L529.0 170.1465" stroke-width="2.0" stroke-linejoin="round" stroke="#e33933"/><path fill="none" marker-end="url(#id5)" d="M370.6013339746895 423.32325 L529.0 406.1465" stroke-width="2.0" stroke-linejoin="round" stroke="#e33933"/><path fill="none" marker-end="url(#id6)" d="M370.6013339746895 457.67674999999997 L529.0 474.8535" stroke-width="2.0" stroke-linejoin="round" stroke="#97d077"/><path fill="none" marker-end="url(#id7)" d="M370.94082015818594 221.53569544483895 L529.0 233.75752170027454" stroke-width="2.0" stroke-linejoin="round" stroke="#97d077"/><g transform="translate(389.0 160.1465)"><clipPath id="id8"><path d="M0 0 L58.0 0 L58.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id8)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="50.0">writable</tspan></text></g><g transform="translate(389.0 225.3535)"><clipPath id="id9"><path d="M0 0 L58.0 0 L58.0 27.0 L0 27.0z"/></clipPath><text font-size="12" clip-path="url(#id9)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="51.0">readonly</tspan></text></g><g transform="translate(389.0 396.1465)"><clipPath id="id10"><path d="M0 0 L58.0 0 L58.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id10)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="50.0">writable</tspan></text></g><g transform="translate(389.0 461.3535)"><clipPath id="id11"><path d="M0 0 L58.0 0 L58.0 27.0 L0 27.0z"/></clipPath><text font-size="12" clip-path="url(#id11)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="51.0">readonly</tspan></text></g><g transform="translate(116.5 213.8535)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15939999999996 42.67725 Q81.31799499999998 50.0 57.50000000000001 50.0 Q33.68292499999999 50.0 16.841465489999997 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.841463189999995 7.3223763 Q33.68292499999999 0.0 57.50000000000001 0.0 Q81.31840209999994 0.0 98.15939999999996 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(15.920599842071528 7.961000442504883)"><clipPath id="id12"><path d="M0 0 L83.16799964904784 0 L83.16799964904784 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id12)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="14.0" xml:space="preserve" y="21.423999786376953" textLength="54.0">Publisher</tspan></text></g></g><g transform="translate(116.5 145.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15939999999996 42.67725 Q81.31799499999998 50.0 57.50000000000001 50.0 Q33.68292499999999 50.0 16.841465489999997 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.841463189999995 7.3223763 Q33.68292499999999 0.0 57.50000000000001 0.0 Q81.31840209999994 0.0 98.15939999999996 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(15.920599842071528 7.961000442504883)"><clipPath id="id13"><path d="M0 0 L83.16799964904784 0 L83.16799964904784 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id13)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="27.0" xml:space="preserve" y="21.423999786376953" textLength="28.0">Book</tspan></text></g></g><g transform="translate(116.5 415.5)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15939999999996 42.67725 Q81.31799499999998 50.0 57.50000000000001 50.0 Q33.68292499999999 50.0 16.841465489999997 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.841463189999995 7.3223763 Q33.68292499999999 0.0 57.50000000000001 0.0 Q81.31840209999994 0.0 98.15939999999996 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(14.920599842071528 7.961000442504883)"><clipPath id="id14"><path d="M0 0 L83.16799964904784 0 L83.16799964904784 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id14)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="14.0" xml:space="preserve" y="21.423999786376953" textLength="55.0">Comment</tspan></text></g></g><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 170.1465 L319.61622482651507 187.46430654493017" stroke="#000000" stroke-width="2.0" marker-end="url(#id15)"/><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 238.8535 L319.61622482651507 221.53569544483895" stroke="#000000" stroke-width="2.0" marker-end="url(#id16)"/><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 440.5 L293.5289580126552 440.5" stroke="#000000" stroke-width="2.0" marker-end="url(#id17)"/><g transform="translate(89.0 100.0)"><clipPath id="id18"><path d="M0 0 L176.0 0 L176.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id18)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="bold"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="169.0">Model &lt; ActiveRecord::Base</tspan></text></g><g transform="translate(322.91054198734474 100.0)"><clipPath id="id19"><path d="M0 0 L44.0 0 L44.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id19)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="bold"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="35.0">Proxy</tspan></text></g><g transform="translate(116.5 299.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15940000000002 42.67725 Q81.31799500000004 50.0 57.50000000000001 50.0 Q33.68292500000001 50.0 16.84146549 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.84146319000001 7.3223763 Q33.68292500000001 0.0 57.50000000000001 0.0 Q81.31840210000003 0.0 98.15940000000002 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(14.92059984207154 7.961000442504883)"><clipPath id="id20"><path d="M0 0 L83.16799964904786 0 L83.16799964904786 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id20)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="21.423999786376953" textLength="46.0">BigData</tspan></text></g></g><g transform="translate(293.95090530472953 290.0751120949758)"><path fill="#ffffff" fill-opacity="1.0" d="M50.95963817063662 68.14277779981754 L-1.5432100042289676E-14 34.071388899908776 L50.95963817063662 1.3489209749195652E-14 L101.91927634127326 34.071388899908776 L50.95963817063662 68.14277779981754 L50.95963817063662 68.14277779981754z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(19.633727393157077 20.881670919088414)"><clipPath id="id21"><path d="M0 0 L62.14222129521437 0 L62.14222129521437 26.463928188151918 L0 26.463928188151918z"/></clipPath><text font-size="12" clip-path="url(#id21)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="10.0" xml:space="preserve" y="17.73196409407596" textLength="41.0">special</tspan></text></g></g><g transform="translate(529.0 294.89650099488455)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L63.99999999999999 6.0 L63.99999999999999 52.5 Q63.99999999999999 54.98528137423857 54.6274169979695 56.742640687119284 Q45.254833995939045 58.5 31.999999999999975 58.5 Q18.74516600406095 58.5 9.37258300203047 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M63.99999999999999 6.0 Q63.99999999999999 8.485281374238571 54.6274169979695 10.242640687119284 Q45.254833995939045 11.999999999999998 31.999999999999996 12.0 Q18.745166004060952 12.0 9.37258300203048 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.37258300203047 1.7573593128807152 Q18.74516600406095 8.881784197001252E-16 31.999999999999975 0.0 Q45.254833995939045 -8.881784197001252E-16 54.6274169979695 1.7573593128807143 Q63.99999999999999 3.5147186257614287 63.99999999999999 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id22"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id22)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="10.75" textLength="28.0">main</tspan><tspan x="11.0" xml:space="preserve" y="27.75" textLength="41.0">special</tspan><tspan x="16.0" xml:space="preserve" y="44.75" textLength="31.0">slave</tspan></text></g></g><g transform="translate(529.0 209.6035)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L64.00000000000006 6.0 L64.00000000000006 52.5 Q64.00000000000006 54.98528137423857 54.62741699796954 56.742640687119284 Q45.25483399593911 58.5 32.00000000000002 58.5 Q18.745166004060973 58.5 9.372583002030485 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M64.00000000000006 6.0 Q64.00000000000006 8.485281374238571 54.62741699796954 10.242640687119284 Q45.25483399593911 11.999999999999998 32.00000000000003 12.0 Q18.745166004060973 12.0 9.372583002030488 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030485 1.7573593128807152 Q18.745166004060973 8.881784197001252E-16 32.00000000000002 0.0 Q45.25483399593911 -8.881784197001252E-16 54.62741699796954 1.7573593128807143 Q64.00000000000006 3.5147186257614287 64.00000000000006 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id23"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id23)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="19.25" textLength="28.0">main</tspan><tspan x="16.0" xml:space="preserve" y="36.25" textLength="31.0">slave</tspan></text></g></g><g transform="translate(529.0 445.6035)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L64.00000000000006 6.0 L64.00000000000006 52.5 Q64.00000000000006 54.98528137423857 54.62741699796954 56.742640687119284 Q45.25483399593911 58.5 32.00000000000002 58.5 Q18.745166004060973 58.5 9.372583002030485 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M64.00000000000006 6.0 Q64.00000000000006 8.485281374238571 54.62741699796954 10.242640687119284 Q45.25483399593911 11.999999999999998 32.00000000000003 12.0 Q18.745166004060973 12.0 9.372583002030488 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030485 1.7573593128807152 Q18.745166004060973 8.881784197001252E-16 32.00000000000002 0.0 Q45.25483399593911 -8.881784197001252E-16 54.62741699796954 1.7573593128807143 Q64.00000000000006 3.5147186257614287 64.00000000000006 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id24"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id24)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="5.0" xml:space="preserve" y="19.25" textLength="53.0">comment</tspan><tspan x="16.0" xml:space="preserve" y="36.25" textLength="31.0">slave</tspan></text></g></g><g transform="translate(529.0 100.0)"><clipPath id="id25"><path d="M0 0 L64.0 0 L64.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id25)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="bold"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="55.0">Database</tspan></text></g><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 324.1465 L293.95090530472953 324.14650099488455" stroke="#000000" stroke-width="2.0" marker-end="url(#id26)"/><path fill="none" marker-end="url(#id27)" d="M370.3903625606845 307.1108065449302 L529.0 184.77149999999997" stroke-width="2.0" stroke-linejoin="round" stroke="#e33933"/><path fill="none" marker-end="url(#id28)" d="M370.3903625606845 341.18219544483895 L529.0 324.14650099488455" stroke-width="2.0" stroke-linejoin="round" stroke="#74c14a"/><g transform="translate(389.0 344.7178898947933)"><clipPath id="id29"><path d="M0 0 L58.0 0 L58.0 27.0 L0 27.0z"/></clipPath><text font-size="12" clip-path="url(#id29)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="51.0">readonly</tspan></text></g><g transform="translate(395.87018164600283 280.0751120949758)"><clipPath id="id30"><path d="M0 0 L58.0 0 L58.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id30)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="50.0">writable</tspan></text></g></g></svg>
2
+ <svg contentScriptType="text/ecmascript" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" contentStyleType="text/css" viewBox="74.0 85.0 534.0 434.1035" xmlns:cacoo="http://cacoo.com/" preserveAspectRatio="xMidYMin meet" xmlns="http://www.w3.org/2000/svg" version="1.1"><defs><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id4" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#e33933"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id5" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#e33933"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id6" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#97d077"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id7" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#97d077"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id15" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id16" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id17" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id26" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#000000"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id27" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#e33933"/></marker><marker refX="14.0" refY="7.0" markerUnits="userSpaceOnUse" orient="auto" id="id28" markerHeight="14.0" viewBox="0 0 14.0 14.0" preserveAspectRatio="xMidYMid meet" markerWidth="14.0" overflow="visible"><path fill="none" d="M0 0 L14.0 7.0 L0 14.0" stroke-width="2.0" stroke-linejoin="round" stroke-linecap="round" stroke="#74c14a"/></marker></defs><g><g transform="translate(529.0 140.8965)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L64.00000000000006 6.0 L64.00000000000006 52.5 Q64.00000000000006 54.98528137423857 54.62741699796954 56.742640687119284 Q45.25483399593911 58.5 32.00000000000002 58.5 Q18.745166004060973 58.5 9.372583002030485 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M64.00000000000006 6.0 Q64.00000000000006 8.485281374238571 54.62741699796954 10.242640687119284 Q45.25483399593911 11.999999999999998 32.00000000000003 12.0 Q18.745166004060973 12.0 9.372583002030488 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030485 1.7573593128807152 Q18.745166004060973 8.881784197001252E-16 32.00000000000002 0.0 Q45.25483399593911 -8.881784197001252E-16 54.62741699796954 1.7573593128807143 Q64.00000000000006 3.5147186257614287 64.00000000000006 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id0"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id0)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="19.25" textLength="28.0">main</tspan><tspan x="11.0" xml:space="preserve" y="36.25" textLength="41.0">master</tspan></text></g></g><g transform="translate(529.0 376.8965)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L63.99999999999992 6.0 L63.99999999999992 52.5 Q63.99999999999992 54.98528137423857 54.62741699796942 56.742640687119284 Q45.25483399593904 58.5 31.999999999999932 58.5 Q18.745166004060934 58.5 9.372583002030463 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M63.99999999999992 6.0 Q63.99999999999992 8.485281374238571 54.62741699796942 10.242640687119284 Q45.25483399593904 11.999999999999998 31.99999999999996 12.0 Q18.74516600406094 12.0 9.37258300203047 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030463 1.7573593128807152 Q18.745166004060934 8.881784197001252E-16 31.999999999999932 0.0 Q45.25483399593904 -8.881784197001252E-16 54.62741699796942 1.7573593128807143 Q63.99999999999992 3.5147186257614287 63.99999999999992 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id1"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id1)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="5.0" xml:space="preserve" y="19.25" textLength="46.0">comment</tspan><tspan x="11.0" xml:space="preserve" y="36.25" textLength="41.0">master</tspan></text></g></g><g transform="translate(293.5289580126552 170.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M51.74956447969533 68.4248898947933 L0.424969148024419 34.35350099488455 L51.74956447969533 0.28211209497580036 L103.07415981136624 34.35350099488455 L51.74956447969533 68.4248898947933 L51.74956447969533 68.4248898947933z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(20.199307221852635 21.163783014064215)"><clipPath id="id2"><path d="M0 0 L62.58726465655704 0 L62.58726465655704 26.463928188151897 L0 26.463928188151897z"/></clipPath><text font-size="12" clip-path="url(#id2)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="17.0" xml:space="preserve" y="17.73196409407595" textLength="28.0">main</tspan></text></g></g><g transform="translate(293.5289580126552 406.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M51.381583974689526 68.70699999999998 L7.148564543362447E-16 34.35349999999998 L51.381583974689526 -5.911707234851347E-15 L102.76316794937905 34.35349999999998 L51.381583974689526 68.70699999999998 L51.381583974689526 68.70699999999998z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(19.79629465597243 21.054571154298447)"><clipPath id="id3"><path d="M0 0 L62.65675888753867 0 L62.65675888753867 26.683049513549793 L0 26.683049513549793z"/></clipPath><text font-size="12" clip-path="url(#id3)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="5.0" xml:space="preserve" y="17.841524756774895" textLength="53.0">comment</tspan></text></g></g><path fill="none" marker-end="url(#id4)" d="M370.94082015818594 187.46430654493017 L529.0 170.1465" stroke-width="2.0" stroke-linejoin="round" stroke="#e33933"/><path fill="none" marker-end="url(#id5)" d="M370.6013339746895 423.32325 L529.0 406.1465" stroke-width="2.0" stroke-linejoin="round" stroke="#e33933"/><path fill="none" marker-end="url(#id6)" d="M370.6013339746895 457.67674999999997 L529.0 474.8535" stroke-width="2.0" stroke-linejoin="round" stroke="#97d077"/><path fill="none" marker-end="url(#id7)" d="M370.94082015818594 221.53569544483895 L529.0 233.75752170027454" stroke-width="2.0" stroke-linejoin="round" stroke="#97d077"/><g transform="translate(389.0 160.1465)"><clipPath id="id8"><path d="M0 0 L58.0 0 L58.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id8)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="50.0">writable</tspan></text></g><g transform="translate(389.0 225.3535)"><clipPath id="id9"><path d="M0 0 L58.0 0 L58.0 27.0 L0 27.0z"/></clipPath><text font-size="12" clip-path="url(#id9)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="51.0">readonly</tspan></text></g><g transform="translate(389.0 396.1465)"><clipPath id="id10"><path d="M0 0 L58.0 0 L58.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id10)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="50.0">writable</tspan></text></g><g transform="translate(389.0 461.3535)"><clipPath id="id11"><path d="M0 0 L58.0 0 L58.0 27.0 L0 27.0z"/></clipPath><text font-size="12" clip-path="url(#id11)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="51.0">readonly</tspan></text></g><g transform="translate(116.5 213.8535)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15939999999996 42.67725 Q81.31799499999998 50.0 57.50000000000001 50.0 Q33.68292499999999 50.0 16.841465489999997 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.841463189999995 7.3223763 Q33.68292499999999 0.0 57.50000000000001 0.0 Q81.31840209999994 0.0 98.15939999999996 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(15.920599842071528 7.961000442504883)"><clipPath id="id12"><path d="M0 0 L83.16799964904784 0 L83.16799964904784 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id12)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="14.0" xml:space="preserve" y="21.423999786376953" textLength="54.0">Publisher</tspan></text></g></g><g transform="translate(116.5 145.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15939999999996 42.67725 Q81.31799499999998 50.0 57.50000000000001 50.0 Q33.68292499999999 50.0 16.841465489999997 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.841463189999995 7.3223763 Q33.68292499999999 0.0 57.50000000000001 0.0 Q81.31840209999994 0.0 98.15939999999996 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(15.920599842071528 7.961000442504883)"><clipPath id="id13"><path d="M0 0 L83.16799964904784 0 L83.16799964904784 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id13)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="27.0" xml:space="preserve" y="21.423999786376953" textLength="28.0">Book</tspan></text></g></g><g transform="translate(116.5 415.5)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15939999999996 42.67725 Q81.31799499999998 50.0 57.50000000000001 50.0 Q33.68292499999999 50.0 16.841465489999997 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.841463189999995 7.3223763 Q33.68292499999999 0.0 57.50000000000001 0.0 Q81.31840209999994 0.0 98.15939999999996 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(14.920599842071528 7.961000442504883)"><clipPath id="id14"><path d="M0 0 L83.16799964904784 0 L83.16799964904784 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id14)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="14.0" xml:space="preserve" y="21.423999786376953" textLength="55.0">Comment</tspan></text></g></g><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 170.1465 L319.61622482651507 187.46430654493017" stroke="#000000" stroke-width="2.0" marker-end="url(#id15)"/><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 238.8535 L319.61622482651507 221.53569544483895" stroke="#000000" stroke-width="2.0" marker-end="url(#id16)"/><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 440.5 L293.5289580126552 440.5" stroke="#000000" stroke-width="2.0" marker-end="url(#id17)"/><g transform="translate(89.0 100.0)"><clipPath id="id18"><path d="M0 0 L176.0 0 L176.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id18)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="bold"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="169.0">Model &lt; ActiveRecord::Base</tspan></text></g><g transform="translate(322.91054198734474 100.0)"><clipPath id="id19"><path d="M0 0 L44.0 0 L44.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id19)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="bold"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="35.0">Proxy</tspan></text></g><g transform="translate(116.5 299.1465)"><path fill="#ffffff" fill-opacity="1.0" d="M115.00000000000001 25.0 Q115.00000000000001 35.354843 98.15940000000002 42.67725 Q81.31799500000004 50.0 57.50000000000001 50.0 Q33.68292500000001 50.0 16.84146549 42.677624 Q0.0 35.35525 0.0 25.0 Q0.0 14.64475 16.84146319000001 7.3223763 Q33.68292500000001 0.0 57.50000000000001 0.0 Q81.31840210000003 0.0 98.15940000000002 7.3223753 Q115.00000000000001 14.644578 115.00000000000001 25.0 L115.00000000000001 25.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(14.92059984207154 7.961000442504883)"><clipPath id="id20"><path d="M0 0 L83.16799964904786 0 L83.16799964904786 33.847999572753906 L0 33.847999572753906z"/></clipPath><text font-size="12" clip-path="url(#id20)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="21.423999786376953" textLength="46.0">BigData</tspan></text></g></g><g transform="translate(293.95090530472953 290.0751120949758)"><path fill="#ffffff" fill-opacity="1.0" d="M50.95963817063662 68.14277779981754 L-1.5432100042289676E-14 34.071388899908776 L50.95963817063662 1.3489209749195652E-14 L101.91927634127326 34.071388899908776 L50.95963817063662 68.14277779981754 L50.95963817063662 68.14277779981754z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(19.633727393157077 20.881670919088414)"><clipPath id="id21"><path d="M0 0 L62.14222129521437 0 L62.14222129521437 26.463928188151918 L0 26.463928188151918z"/></clipPath><text font-size="12" clip-path="url(#id21)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="10.0" xml:space="preserve" y="17.73196409407596" textLength="41.0">special</tspan></text></g></g><g transform="translate(529.0 294.89650099488455)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L63.99999999999999 6.0 L63.99999999999999 52.5 Q63.99999999999999 54.98528137423857 54.6274169979695 56.742640687119284 Q45.254833995939045 58.5 31.999999999999975 58.5 Q18.74516600406095 58.5 9.37258300203047 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M63.99999999999999 6.0 Q63.99999999999999 8.485281374238571 54.6274169979695 10.242640687119284 Q45.254833995939045 11.999999999999998 31.999999999999996 12.0 Q18.745166004060952 12.0 9.37258300203048 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.37258300203047 1.7573593128807152 Q18.74516600406095 8.881784197001252E-16 31.999999999999975 0.0 Q45.254833995939045 -8.881784197001252E-16 54.6274169979695 1.7573593128807143 Q63.99999999999999 3.5147186257614287 63.99999999999999 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id22"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id22)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="10.75" textLength="28.0">main</tspan><tspan x="11.0" xml:space="preserve" y="27.75" textLength="41.0">special</tspan><tspan x="16.0" xml:space="preserve" y="44.75" textLength="31.0">slave</tspan></text></g></g><g transform="translate(529.0 209.6035)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L64.00000000000006 6.0 L64.00000000000006 52.5 Q64.00000000000006 54.98528137423857 54.62741699796954 56.742640687119284 Q45.25483399593911 58.5 32.00000000000002 58.5 Q18.745166004060973 58.5 9.372583002030485 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M64.00000000000006 6.0 Q64.00000000000006 8.485281374238571 54.62741699796954 10.242640687119284 Q45.25483399593911 11.999999999999998 32.00000000000003 12.0 Q18.745166004060973 12.0 9.372583002030488 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030485 1.7573593128807152 Q18.745166004060973 8.881784197001252E-16 32.00000000000002 0.0 Q45.25483399593911 -8.881784197001252E-16 54.62741699796954 1.7573593128807143 Q64.00000000000006 3.5147186257614287 64.00000000000006 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id23"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id23)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="18.0" xml:space="preserve" y="19.25" textLength="28.0">main</tspan><tspan x="16.0" xml:space="preserve" y="36.25" textLength="31.0">slave</tspan></text></g></g><g transform="translate(529.0 445.6035)"><path fill="#ffffff" fill-opacity="1.0" d="M0.0 6.0 L64.00000000000006 6.0 L64.00000000000006 52.5 Q64.00000000000006 54.98528137423857 54.62741699796954 56.742640687119284 Q45.25483399593911 58.5 32.00000000000002 58.5 Q18.745166004060973 58.5 9.372583002030485 56.742640687119284 Q0.0 54.98528137423857 0.0 52.5 L0.0 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><path fill="#ffffff" fill-opacity="1.0" d="M64.00000000000006 6.0 Q64.00000000000006 8.485281374238571 54.62741699796954 10.242640687119284 Q45.25483399593911 11.999999999999998 32.00000000000003 12.0 Q18.745166004060973 12.0 9.372583002030488 10.242640687119286 Q0.0 8.485281374238571 0.0 6.000000000000001 Q0.0 3.5147186257614313 9.372583002030485 1.7573593128807152 Q18.745166004060973 8.881784197001252E-16 32.00000000000002 0.0 Q45.25483399593911 -8.881784197001252E-16 54.62741699796954 1.7573593128807143 Q64.00000000000006 3.5147186257614287 64.00000000000006 6.0z" stroke-width="1.0" stroke-linejoin="round" stroke="#000000"/><g transform="translate(0.0 12.0)"><clipPath id="id24"><path d="M0 0 L64.0 0 L64.0 46.5 L0 46.5z"/></clipPath><text font-size="12" clip-path="url(#id24)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="5.0" xml:space="preserve" y="19.25" textLength="53.0">comment</tspan><tspan x="16.0" xml:space="preserve" y="36.25" textLength="31.0">slave</tspan></text></g></g><g transform="translate(529.0 100.0)"><clipPath id="id25"><path d="M0 0 L64.0 0 L64.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id25)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="bold"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="55.0">Database</tspan></text></g><path fill="none" stroke-linejoin="round" stroke-dasharray="6.0 2.0" d="M231.5 324.1465 L293.95090530472953 324.14650099488455" stroke="#000000" stroke-width="2.0" marker-end="url(#id26)"/><path fill="none" marker-end="url(#id27)" d="M370.3903625606845 307.1108065449302 L529.0 184.77149999999997" stroke-width="2.0" stroke-linejoin="round" stroke="#e33933"/><path fill="none" marker-end="url(#id28)" d="M370.3903625606845 341.18219544483895 L529.0 324.14650099488455" stroke-width="2.0" stroke-linejoin="round" stroke="#74c14a"/><g transform="translate(389.0 344.7178898947933)"><clipPath id="id29"><path d="M0 0 L58.0 0 L58.0 27.0 L0 27.0z"/></clipPath><text font-size="12" clip-path="url(#id29)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="51.0">readonly</tspan></text></g><g transform="translate(395.87018164600283 280.0751120949758)"><clipPath id="id30"><path d="M0 0 L58.0 0 L58.0 20.0 L0 20.0z"/></clipPath><text font-size="12" clip-path="url(#id30)" text-decoration="none" fill="#000000" font-family="Arial,Arial" font-style="normal" font-weight="normal"><tspan x="2.0" xml:space="preserve" y="15.0" textLength="50.0">writable</tspan></text></g></g></svg>
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'benchmark/ips'
4
+ require 'switch_point'
5
+ require 'active_record'
6
+
7
+ SwitchPoint.configure do |config|
8
+ config.define_switch_point :proxy,
9
+ readonly: :proxy_readonly,
10
+ writable: :proxy_writable
11
+ end
12
+
13
+ class Plain < ActiveRecord::Base
14
+ end
15
+
16
+ class Proxy1 < ActiveRecord::Base
17
+ use_switch_point :proxy
18
+ end
19
+
20
+ class ProxyBase < ActiveRecord::Base
21
+ self.abstract_class = true
22
+ use_switch_point :proxy
23
+ end
24
+
25
+ class Proxy2 < ProxyBase
26
+ end
27
+
28
+ database_config = { adapter: 'sqlite3', database: ':memory:' }
29
+ ActiveRecord::Base.configurations = {
30
+ 'default' => database_config.dup,
31
+ 'proxy_readonly' => database_config.dup,
32
+ 'proxy_writable' => database_config.dup,
33
+ }
34
+ ActiveRecord::Base.establish_connection(:default)
35
+
36
+ Plain.connection.execute('CREATE TABLE plains (id integer primary key autoincrement)')
37
+ %i[readonly writable].each do |mode|
38
+ ProxyBase.public_send("with_#{mode}") do
39
+ %w[proxy1s proxy2s].each do |table|
40
+ ProxyBase.connection.execute("CREATE TABLE #{table} (id integer primary key autoincrement)")
41
+ end
42
+ end
43
+ end
44
+
45
+ Benchmark.ips do |x|
46
+ x.report('plain') do
47
+ Plain.create
48
+ Plain.first
49
+ end
50
+
51
+ x.report('proxy1') do
52
+ Proxy1.with_writable { Proxy1.create }
53
+ Proxy1.first
54
+ end
55
+
56
+ x.report('proxy2') do
57
+ Proxy2.with_writable { Proxy2.create }
58
+ Proxy2.first
59
+ end
60
+
61
+ x.compare!
62
+ end
@@ -2,6 +2,10 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 3.2"
5
+ gem "activerecord", "~> 3.2.0"
6
6
 
7
- gemspec :path => "../"
7
+ platforms :ruby do
8
+ gem "sqlite3", "~> 1.3.5"
9
+ end
10
+
11
+ gemspec path: "../"
@@ -2,6 +2,10 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 4.0"
5
+ gem "activerecord", "~> 4.0.0"
6
6
 
7
- gemspec :path => "../"
7
+ platforms :ruby do
8
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec path: "../"
@@ -2,6 +2,10 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 4.1"
5
+ gem "activerecord", "~> 4.1.0"
6
6
 
7
- gemspec :path => "../"
7
+ platforms :ruby do
8
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 4.2.0"
6
+
7
+ platforms :ruby do
8
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 5.0.0"
6
+
7
+ platforms :ruby do
8
+ gem "sqlite3", "~> 1.3.6"
9
+ end
10
+
11
+ gemspec path: "../"