ar-octopus-master 0.9.2.master → 0.9.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rubocop.yml +46 -0
- data/.rubocop_todo.yml +56 -0
- data/.travis.yml +25 -0
- data/Appraisals +20 -0
- data/Gemfile +4 -0
- data/README.mkdn +242 -0
- data/Rakefile +172 -0
- data/TODO.txt +7 -0
- data/ar-octopus.gemspec +39 -0
- data/gemfiles/rails4.gemfile +7 -0
- data/gemfiles/rails41.gemfile +7 -0
- data/gemfiles/rails42.gemfile +7 -0
- data/gemfiles/rails5.gemfile +7 -0
- data/gemfiles/rails51.gemfile +7 -0
- data/lib/ar-octopus.rb +1 -0
- data/lib/octopus.rb +205 -0
- data/lib/octopus/abstract_adapter.rb +33 -0
- data/lib/octopus/association.rb +14 -0
- data/lib/octopus/association_shard_tracking.rb +74 -0
- data/lib/octopus/collection_association.rb +17 -0
- data/lib/octopus/collection_proxy.rb +16 -0
- data/lib/octopus/exception.rb +4 -0
- data/lib/octopus/finder_methods.rb +8 -0
- data/lib/octopus/has_and_belongs_to_many_association.rb +9 -0
- data/lib/octopus/load_balancing.rb +4 -0
- data/lib/octopus/load_balancing/round_robin.rb +20 -0
- data/lib/octopus/log_subscriber.rb +26 -0
- data/lib/octopus/migration.rb +195 -0
- data/lib/octopus/model.rb +223 -0
- data/lib/octopus/persistence.rb +45 -0
- data/lib/octopus/proxy.rb +346 -0
- data/lib/octopus/proxy_config.rb +252 -0
- data/lib/octopus/query_cache_for_shards.rb +25 -0
- data/lib/octopus/railtie.rb +11 -0
- data/lib/octopus/relation_proxy.rb +58 -0
- data/lib/octopus/result_patch.rb +19 -0
- data/lib/octopus/scope_proxy.rb +68 -0
- data/lib/octopus/shard_tracking.rb +46 -0
- data/lib/octopus/shard_tracking/attribute.rb +22 -0
- data/lib/octopus/shard_tracking/dynamic.rb +11 -0
- data/lib/octopus/singular_association.rb +9 -0
- data/lib/octopus/slave_group.rb +13 -0
- data/lib/octopus/version.rb +3 -0
- data/lib/tasks/octopus.rake +16 -0
- data/sample_app/.gitignore +4 -0
- data/sample_app/.rspec +1 -0
- data/sample_app/Gemfile +20 -0
- data/sample_app/README +3 -0
- data/sample_app/README.rdoc +261 -0
- data/sample_app/Rakefile +7 -0
- data/sample_app/app/assets/images/rails.png +0 -0
- data/sample_app/app/assets/javascripts/application.js +15 -0
- data/sample_app/app/assets/stylesheets/application.css +13 -0
- data/sample_app/app/controllers/application_controller.rb +4 -0
- data/sample_app/app/helpers/application_helper.rb +2 -0
- data/sample_app/app/mailers/.gitkeep +0 -0
- data/sample_app/app/models/.gitkeep +0 -0
- data/sample_app/app/models/item.rb +3 -0
- data/sample_app/app/models/user.rb +3 -0
- data/sample_app/app/views/layouts/application.html.erb +14 -0
- data/sample_app/autotest/discover.rb +2 -0
- data/sample_app/config.ru +4 -0
- data/sample_app/config/application.rb +62 -0
- data/sample_app/config/boot.rb +6 -0
- data/sample_app/config/cucumber.yml +8 -0
- data/sample_app/config/database.yml +28 -0
- data/sample_app/config/environment.rb +5 -0
- data/sample_app/config/environments/development.rb +37 -0
- data/sample_app/config/environments/production.rb +67 -0
- data/sample_app/config/environments/test.rb +37 -0
- data/sample_app/config/initializers/backtrace_silencers.rb +7 -0
- data/sample_app/config/initializers/inflections.rb +15 -0
- data/sample_app/config/initializers/mime_types.rb +5 -0
- data/sample_app/config/initializers/secret_token.rb +7 -0
- data/sample_app/config/initializers/session_store.rb +8 -0
- data/sample_app/config/initializers/wrap_parameters.rb +14 -0
- data/sample_app/config/locales/en.yml +5 -0
- data/sample_app/config/routes.rb +58 -0
- data/sample_app/config/shards.yml +28 -0
- data/sample_app/db/migrate/20100720172715_create_users.rb +15 -0
- data/sample_app/db/migrate/20100720172730_create_items.rb +16 -0
- data/sample_app/db/migrate/20100720210335_create_sample_users.rb +11 -0
- data/sample_app/db/schema.rb +29 -0
- data/sample_app/db/seeds.rb +16 -0
- data/sample_app/doc/README_FOR_APP +2 -0
- data/sample_app/features/migrate.feature +45 -0
- data/sample_app/features/seed.feature +15 -0
- data/sample_app/features/step_definitions/seeds_steps.rb +13 -0
- data/sample_app/features/step_definitions/web_steps.rb +218 -0
- data/sample_app/features/support/database.rb +13 -0
- data/sample_app/features/support/env.rb +57 -0
- data/sample_app/features/support/paths.rb +33 -0
- data/sample_app/lib/assets/.gitkeep +0 -0
- data/sample_app/lib/tasks/.gitkeep +0 -0
- data/sample_app/lib/tasks/cucumber.rake +64 -0
- data/sample_app/log/.gitkeep +0 -0
- data/sample_app/public/404.html +26 -0
- data/sample_app/public/422.html +26 -0
- data/sample_app/public/500.html +26 -0
- data/sample_app/public/favicon.ico +0 -0
- data/sample_app/public/images/rails.png +0 -0
- data/sample_app/public/index.html +279 -0
- data/sample_app/public/javascripts/application.js +2 -0
- data/sample_app/public/javascripts/controls.js +965 -0
- data/sample_app/public/javascripts/dragdrop.js +974 -0
- data/sample_app/public/javascripts/effects.js +1123 -0
- data/sample_app/public/javascripts/prototype.js +4874 -0
- data/sample_app/public/javascripts/rails.js +118 -0
- data/sample_app/public/robots.txt +5 -0
- data/sample_app/public/stylesheets/.gitkeep +0 -0
- data/sample_app/script/cucumber +10 -0
- data/sample_app/script/rails +6 -0
- data/sample_app/spec/models/item_spec.rb +5 -0
- data/sample_app/spec/models/user_spec.rb +5 -0
- data/sample_app/spec/spec_helper.rb +27 -0
- data/sample_app/vendor/assets/javascripts/.gitkeep +0 -0
- data/sample_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/sample_app/vendor/plugins/.gitkeep +0 -0
- data/spec/config/shards.yml +229 -0
- data/spec/migrations/10_create_users_using_replication.rb +9 -0
- data/spec/migrations/11_add_field_in_all_slaves.rb +11 -0
- data/spec/migrations/12_create_users_using_block.rb +23 -0
- data/spec/migrations/13_create_users_using_block_and_using.rb +15 -0
- data/spec/migrations/14_create_users_on_shards_of_a_group_with_versions.rb +11 -0
- data/spec/migrations/15_create_user_on_shards_of_default_group_with_versions.rb +9 -0
- data/spec/migrations/1_create_users_on_master.rb +9 -0
- data/spec/migrations/2_create_users_on_canada.rb +11 -0
- data/spec/migrations/3_create_users_on_both_shards.rb +11 -0
- data/spec/migrations/4_create_users_on_shards_of_a_group.rb +11 -0
- data/spec/migrations/5_create_users_on_multiples_groups.rb +11 -0
- data/spec/migrations/6_raise_exception_with_invalid_shard_name.rb +11 -0
- data/spec/migrations/7_raise_exception_with_invalid_multiple_shard_names.rb +11 -0
- data/spec/migrations/8_raise_exception_with_invalid_group_name.rb +11 -0
- data/spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb +11 -0
- data/spec/octopus/association_shard_tracking_spec.rb +1036 -0
- data/spec/octopus/collection_proxy_spec.rb +16 -0
- data/spec/octopus/load_balancing/round_robin_spec.rb +15 -0
- data/spec/octopus/log_subscriber_spec.rb +19 -0
- data/spec/octopus/migration_spec.rb +134 -0
- data/spec/octopus/model_spec.rb +754 -0
- data/spec/octopus/octopus_spec.rb +123 -0
- data/spec/octopus/proxy_spec.rb +303 -0
- data/spec/octopus/query_cache_for_shards_spec.rb +17 -0
- data/spec/octopus/relation_proxy_spec.rb +124 -0
- data/spec/octopus/replicated_slave_grouped_spec.rb +91 -0
- data/spec/octopus/replication_spec.rb +196 -0
- data/spec/octopus/scope_proxy_spec.rb +97 -0
- data/spec/octopus/sharded_replicated_slave_grouped_spec.rb +55 -0
- data/spec/octopus/sharded_spec.rb +33 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/active_record/connection_adapters/modify_config_adapter.rb +15 -0
- data/spec/support/database_connection.rb +4 -0
- data/spec/support/database_models.rb +118 -0
- data/spec/support/octopus_helper.rb +54 -0
- data/spec/support/query_count.rb +17 -0
- data/spec/support/shared_contexts.rb +18 -0
- data/spec/tasks/octopus.rake_spec.rb +32 -0
- metadata +203 -5
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'pry'
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'octopus'
|
5
|
+
|
6
|
+
Octopus.instance_variable_set(:@directory, File.dirname(__FILE__))
|
7
|
+
|
8
|
+
BaseOctopusMigrationClass = (Octopus.rails4? ? ActiveRecord::Migration : ActiveRecord::Migration[ActiveRecord::VERSION::STRING[0..2]])
|
9
|
+
|
10
|
+
# Requires supporting files with custom matchers and macros, etc,
|
11
|
+
# in ./support/ and its subdirectories.
|
12
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.before(:each) do |example|
|
16
|
+
OctopusHelper.clean_all_shards(example.metadata[:shards])
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class Base
|
3
|
+
def self.modify_config_connection(config)
|
4
|
+
ConnectionAdapters::ModifyConfigAdapter.new(config)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
module ConnectionAdapters
|
9
|
+
class ModifyConfigAdapter < AbstractAdapter
|
10
|
+
def initialize(config)
|
11
|
+
config.replace(config.symbolize_keys)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Rails 3.1 needs to do some introspection around the base class, which requires
|
2
|
+
# the model be a descendent of ActiveRecord::Base.
|
3
|
+
class BlankModel < ActiveRecord::Base; end
|
4
|
+
|
5
|
+
# The user class is just sharded, not replicated
|
6
|
+
class User < ActiveRecord::Base
|
7
|
+
scope :thiago, -> { where(:name => 'Thiago') }
|
8
|
+
|
9
|
+
def awesome_queries
|
10
|
+
Octopus.using(:canada) do
|
11
|
+
User.create(:name => 'teste')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# The client class isn't replicated
|
17
|
+
class Client < ActiveRecord::Base
|
18
|
+
has_many :items
|
19
|
+
has_many :comments, :as => :commentable
|
20
|
+
end
|
21
|
+
|
22
|
+
# This class is replicated
|
23
|
+
class Cat < ActiveRecord::Base
|
24
|
+
replicated_model
|
25
|
+
# sharded_model()
|
26
|
+
end
|
27
|
+
|
28
|
+
# This class sets its own connection
|
29
|
+
class CustomConnection < ActiveRecord::Base
|
30
|
+
self.table_name = 'custom'
|
31
|
+
octopus_establish_connection(:adapter => 'mysql2', :database => 'octopus_shard_2', :username => "#{ENV['MYSQL_USER'] || 'root'}", :password => '')
|
32
|
+
end
|
33
|
+
|
34
|
+
# This items belongs to a client
|
35
|
+
class Item < ActiveRecord::Base
|
36
|
+
belongs_to :client
|
37
|
+
has_many :parts
|
38
|
+
end
|
39
|
+
|
40
|
+
class Part < ActiveRecord::Base
|
41
|
+
belongs_to :item
|
42
|
+
end
|
43
|
+
|
44
|
+
class Keyboard < ActiveRecord::Base
|
45
|
+
replicated_model
|
46
|
+
validates_uniqueness_of :name
|
47
|
+
belongs_to :computer
|
48
|
+
end
|
49
|
+
|
50
|
+
class Computer < ActiveRecord::Base
|
51
|
+
has_one :keyboard
|
52
|
+
end
|
53
|
+
|
54
|
+
class Role < ActiveRecord::Base
|
55
|
+
has_and_belongs_to_many :permissions
|
56
|
+
end
|
57
|
+
|
58
|
+
class Permission < ActiveRecord::Base
|
59
|
+
has_and_belongs_to_many :roles
|
60
|
+
end
|
61
|
+
|
62
|
+
class Assignment < ActiveRecord::Base
|
63
|
+
belongs_to :programmer
|
64
|
+
belongs_to :project
|
65
|
+
end
|
66
|
+
|
67
|
+
class Programmer < ActiveRecord::Base
|
68
|
+
has_many :assignments
|
69
|
+
has_many :projects, :through => :assignments
|
70
|
+
end
|
71
|
+
|
72
|
+
class Project < ActiveRecord::Base
|
73
|
+
has_many :assignments
|
74
|
+
has_many :programmers, :through => :assignments
|
75
|
+
end
|
76
|
+
|
77
|
+
class Comment < ActiveRecord::Base
|
78
|
+
belongs_to :commentable, :polymorphic => true
|
79
|
+
scope :open, -> { where(open: true) }
|
80
|
+
end
|
81
|
+
|
82
|
+
class Bacon < ActiveRecord::Base
|
83
|
+
self.table_name = 'yummy'
|
84
|
+
end
|
85
|
+
|
86
|
+
class Cheese < ActiveRecord::Base
|
87
|
+
self.table_name = 'yummy'
|
88
|
+
end
|
89
|
+
|
90
|
+
class Ham < ActiveRecord::Base
|
91
|
+
self.table_name = 'yummy'
|
92
|
+
end
|
93
|
+
|
94
|
+
# This class sets its own connection
|
95
|
+
class Advert < ActiveRecord::Base
|
96
|
+
establish_connection(:adapter => 'postgresql', :database => 'octopus_shard_1', :username => ENV['POSTGRES_USER'] || 'postgres', :password => '')
|
97
|
+
end
|
98
|
+
|
99
|
+
class MmorpgPlayer < ActiveRecord::Base
|
100
|
+
has_many :weapons
|
101
|
+
has_many :skills
|
102
|
+
end
|
103
|
+
|
104
|
+
class Weapon < ActiveRecord::Base
|
105
|
+
belongs_to :mmorpg_player, :inverse_of => :weapons
|
106
|
+
validates :hand, :uniqueness => { :scope => :mmorpg_player_id }
|
107
|
+
validates_presence_of :mmorpg_player
|
108
|
+
has_many :skills
|
109
|
+
end
|
110
|
+
|
111
|
+
class Skill < ActiveRecord::Base
|
112
|
+
belongs_to :weapon, :inverse_of => :skills
|
113
|
+
belongs_to :mmorpg_player, :inverse_of => :skills
|
114
|
+
|
115
|
+
validates_presence_of :weapon
|
116
|
+
validates_presence_of :mmorpg_player
|
117
|
+
validates :name, :uniqueness => { :scope => :mmorpg_player_id }
|
118
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module OctopusHelper
|
2
|
+
def self.clean_all_shards(shards)
|
3
|
+
if shards.nil?
|
4
|
+
shards = BlankModel.using(:master).connection.shards.keys
|
5
|
+
end
|
6
|
+
|
7
|
+
shards.each do |shard_symbol|
|
8
|
+
%w(schema_migrations users clients cats items keyboards computers permissions_roles roles permissions assignments projects programmers yummy adverts).each do |tables|
|
9
|
+
BlankModel.using(shard_symbol).connection.execute("DELETE FROM #{tables}")
|
10
|
+
end
|
11
|
+
|
12
|
+
if shard_symbol == 'alone_shard'
|
13
|
+
%w(mmorpg_players weapons skills).each do |table|
|
14
|
+
BlankModel.using(shard_symbol).connection.execute("DELETE FROM #{table}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.clean_connection_proxy
|
21
|
+
Thread.current['octopus.current_model'] = nil
|
22
|
+
Thread.current['octopus.current_shard'] = nil
|
23
|
+
Thread.current['octopus.current_group'] = nil
|
24
|
+
Thread.current['octopus.current_slave_group'] = nil
|
25
|
+
Thread.current['octopus.block'] = nil
|
26
|
+
|
27
|
+
ActiveRecord::Base.class_variable_set(:@@connection_proxy, nil)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.migrating_to_version(version, &_block)
|
31
|
+
migrations_root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'migrations'))
|
32
|
+
|
33
|
+
begin
|
34
|
+
ActiveRecord::Migrator.run(:up, migrations_root, version)
|
35
|
+
yield
|
36
|
+
ensure
|
37
|
+
ActiveRecord::Migrator.run(:down, migrations_root, version)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.using_environment(environment, &_block)
|
42
|
+
self.octopus_env = environment.to_s
|
43
|
+
clean_connection_proxy
|
44
|
+
yield
|
45
|
+
ensure
|
46
|
+
self.octopus_env = 'octopus'
|
47
|
+
clean_connection_proxy
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.octopus_env=(env)
|
51
|
+
Octopus.instance_variable_set(:@config, nil)
|
52
|
+
Octopus.stub(:env).and_return(env)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class QueryCounter
|
3
|
+
attr_accessor :query_count
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@query_count = 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_proc
|
10
|
+
lambda(&method(:callback))
|
11
|
+
end
|
12
|
+
|
13
|
+
def callback(_name, _start, _finish, _message_id, values)
|
14
|
+
@query_count += 1 unless %w(CACHE SCHEMA).include?(values[:name])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
shared_context 'with query cache enabled' do
|
2
|
+
let!(:counter) { ActiveRecord::QueryCounter.new }
|
3
|
+
|
4
|
+
before(:each) do
|
5
|
+
ActiveRecord::Base.connection.enable_query_cache!
|
6
|
+
counter.query_count = 0
|
7
|
+
end
|
8
|
+
|
9
|
+
after(:each) do
|
10
|
+
ActiveRecord::Base.connection.disable_query_cache!
|
11
|
+
end
|
12
|
+
|
13
|
+
around(:each) do |example|
|
14
|
+
active_support_subscribed(counter.to_proc, 'sql.active_record') do
|
15
|
+
example.run
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
describe 'octopus.rake' do
|
5
|
+
before do
|
6
|
+
load File.expand_path('../../../lib/tasks/octopus.rake', __FILE__)
|
7
|
+
Rake::Task.define_task(:environment)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'octopus:copy_schema_versions' do
|
11
|
+
class SchemaMigration < ActiveRecord::Base; end
|
12
|
+
|
13
|
+
before do
|
14
|
+
Rake::Task['octopus:copy_schema_versions'].reenable
|
15
|
+
|
16
|
+
path = File.expand_path('../../migrations', __FILE__)
|
17
|
+
ActiveRecord::Migrator.migrations_paths = [path]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'assumes each shard migrated to the current master version' do
|
21
|
+
SchemaMigration.create(:version => 1)
|
22
|
+
SchemaMigration.create(:version => 2)
|
23
|
+
SchemaMigration.create(:version => 3)
|
24
|
+
|
25
|
+
Rake::Task['octopus:copy_schema_versions'].invoke
|
26
|
+
|
27
|
+
ActiveRecord::Base.connection.shard_names.each do |shard_name|
|
28
|
+
expect(Octopus.using(shard_name) { ActiveRecord::SchemaMigration.all.pluck(:version).map(&:to_i).sort }).to eq([1, 2, 3])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-octopus-master
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.2.
|
4
|
+
version: 0.9.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thiago Pradi
|
@@ -180,7 +180,166 @@ email:
|
|
180
180
|
executables: []
|
181
181
|
extensions: []
|
182
182
|
extra_rdoc_files: []
|
183
|
-
files:
|
183
|
+
files:
|
184
|
+
- ".gitignore"
|
185
|
+
- ".rspec"
|
186
|
+
- ".rubocop.yml"
|
187
|
+
- ".rubocop_todo.yml"
|
188
|
+
- ".travis.yml"
|
189
|
+
- Appraisals
|
190
|
+
- Gemfile
|
191
|
+
- README.mkdn
|
192
|
+
- Rakefile
|
193
|
+
- TODO.txt
|
194
|
+
- ar-octopus.gemspec
|
195
|
+
- gemfiles/rails4.gemfile
|
196
|
+
- gemfiles/rails41.gemfile
|
197
|
+
- gemfiles/rails42.gemfile
|
198
|
+
- gemfiles/rails5.gemfile
|
199
|
+
- gemfiles/rails51.gemfile
|
200
|
+
- lib/ar-octopus.rb
|
201
|
+
- lib/octopus.rb
|
202
|
+
- lib/octopus/abstract_adapter.rb
|
203
|
+
- lib/octopus/association.rb
|
204
|
+
- lib/octopus/association_shard_tracking.rb
|
205
|
+
- lib/octopus/collection_association.rb
|
206
|
+
- lib/octopus/collection_proxy.rb
|
207
|
+
- lib/octopus/exception.rb
|
208
|
+
- lib/octopus/finder_methods.rb
|
209
|
+
- lib/octopus/has_and_belongs_to_many_association.rb
|
210
|
+
- lib/octopus/load_balancing.rb
|
211
|
+
- lib/octopus/load_balancing/round_robin.rb
|
212
|
+
- lib/octopus/log_subscriber.rb
|
213
|
+
- lib/octopus/migration.rb
|
214
|
+
- lib/octopus/model.rb
|
215
|
+
- lib/octopus/persistence.rb
|
216
|
+
- lib/octopus/proxy.rb
|
217
|
+
- lib/octopus/proxy_config.rb
|
218
|
+
- lib/octopus/query_cache_for_shards.rb
|
219
|
+
- lib/octopus/railtie.rb
|
220
|
+
- lib/octopus/relation_proxy.rb
|
221
|
+
- lib/octopus/result_patch.rb
|
222
|
+
- lib/octopus/scope_proxy.rb
|
223
|
+
- lib/octopus/shard_tracking.rb
|
224
|
+
- lib/octopus/shard_tracking/attribute.rb
|
225
|
+
- lib/octopus/shard_tracking/dynamic.rb
|
226
|
+
- lib/octopus/singular_association.rb
|
227
|
+
- lib/octopus/slave_group.rb
|
228
|
+
- lib/octopus/version.rb
|
229
|
+
- lib/tasks/octopus.rake
|
230
|
+
- sample_app/.gitignore
|
231
|
+
- sample_app/.rspec
|
232
|
+
- sample_app/Gemfile
|
233
|
+
- sample_app/README
|
234
|
+
- sample_app/README.rdoc
|
235
|
+
- sample_app/Rakefile
|
236
|
+
- sample_app/app/assets/images/rails.png
|
237
|
+
- sample_app/app/assets/javascripts/application.js
|
238
|
+
- sample_app/app/assets/stylesheets/application.css
|
239
|
+
- sample_app/app/controllers/application_controller.rb
|
240
|
+
- sample_app/app/helpers/application_helper.rb
|
241
|
+
- sample_app/app/mailers/.gitkeep
|
242
|
+
- sample_app/app/models/.gitkeep
|
243
|
+
- sample_app/app/models/item.rb
|
244
|
+
- sample_app/app/models/user.rb
|
245
|
+
- sample_app/app/views/layouts/application.html.erb
|
246
|
+
- sample_app/autotest/discover.rb
|
247
|
+
- sample_app/config.ru
|
248
|
+
- sample_app/config/application.rb
|
249
|
+
- sample_app/config/boot.rb
|
250
|
+
- sample_app/config/cucumber.yml
|
251
|
+
- sample_app/config/database.yml
|
252
|
+
- sample_app/config/environment.rb
|
253
|
+
- sample_app/config/environments/development.rb
|
254
|
+
- sample_app/config/environments/production.rb
|
255
|
+
- sample_app/config/environments/test.rb
|
256
|
+
- sample_app/config/initializers/backtrace_silencers.rb
|
257
|
+
- sample_app/config/initializers/inflections.rb
|
258
|
+
- sample_app/config/initializers/mime_types.rb
|
259
|
+
- sample_app/config/initializers/secret_token.rb
|
260
|
+
- sample_app/config/initializers/session_store.rb
|
261
|
+
- sample_app/config/initializers/wrap_parameters.rb
|
262
|
+
- sample_app/config/locales/en.yml
|
263
|
+
- sample_app/config/routes.rb
|
264
|
+
- sample_app/config/shards.yml
|
265
|
+
- sample_app/db/migrate/20100720172715_create_users.rb
|
266
|
+
- sample_app/db/migrate/20100720172730_create_items.rb
|
267
|
+
- sample_app/db/migrate/20100720210335_create_sample_users.rb
|
268
|
+
- sample_app/db/schema.rb
|
269
|
+
- sample_app/db/seeds.rb
|
270
|
+
- sample_app/doc/README_FOR_APP
|
271
|
+
- sample_app/features/migrate.feature
|
272
|
+
- sample_app/features/seed.feature
|
273
|
+
- sample_app/features/step_definitions/seeds_steps.rb
|
274
|
+
- sample_app/features/step_definitions/web_steps.rb
|
275
|
+
- sample_app/features/support/database.rb
|
276
|
+
- sample_app/features/support/env.rb
|
277
|
+
- sample_app/features/support/paths.rb
|
278
|
+
- sample_app/lib/assets/.gitkeep
|
279
|
+
- sample_app/lib/tasks/.gitkeep
|
280
|
+
- sample_app/lib/tasks/cucumber.rake
|
281
|
+
- sample_app/log/.gitkeep
|
282
|
+
- sample_app/public/404.html
|
283
|
+
- sample_app/public/422.html
|
284
|
+
- sample_app/public/500.html
|
285
|
+
- sample_app/public/favicon.ico
|
286
|
+
- sample_app/public/images/rails.png
|
287
|
+
- sample_app/public/index.html
|
288
|
+
- sample_app/public/javascripts/application.js
|
289
|
+
- sample_app/public/javascripts/controls.js
|
290
|
+
- sample_app/public/javascripts/dragdrop.js
|
291
|
+
- sample_app/public/javascripts/effects.js
|
292
|
+
- sample_app/public/javascripts/prototype.js
|
293
|
+
- sample_app/public/javascripts/rails.js
|
294
|
+
- sample_app/public/robots.txt
|
295
|
+
- sample_app/public/stylesheets/.gitkeep
|
296
|
+
- sample_app/script/cucumber
|
297
|
+
- sample_app/script/rails
|
298
|
+
- sample_app/spec/models/item_spec.rb
|
299
|
+
- sample_app/spec/models/user_spec.rb
|
300
|
+
- sample_app/spec/spec_helper.rb
|
301
|
+
- sample_app/vendor/assets/javascripts/.gitkeep
|
302
|
+
- sample_app/vendor/assets/stylesheets/.gitkeep
|
303
|
+
- sample_app/vendor/plugins/.gitkeep
|
304
|
+
- spec/config/shards.yml
|
305
|
+
- spec/migrations/10_create_users_using_replication.rb
|
306
|
+
- spec/migrations/11_add_field_in_all_slaves.rb
|
307
|
+
- spec/migrations/12_create_users_using_block.rb
|
308
|
+
- spec/migrations/13_create_users_using_block_and_using.rb
|
309
|
+
- spec/migrations/14_create_users_on_shards_of_a_group_with_versions.rb
|
310
|
+
- spec/migrations/15_create_user_on_shards_of_default_group_with_versions.rb
|
311
|
+
- spec/migrations/1_create_users_on_master.rb
|
312
|
+
- spec/migrations/2_create_users_on_canada.rb
|
313
|
+
- spec/migrations/3_create_users_on_both_shards.rb
|
314
|
+
- spec/migrations/4_create_users_on_shards_of_a_group.rb
|
315
|
+
- spec/migrations/5_create_users_on_multiples_groups.rb
|
316
|
+
- spec/migrations/6_raise_exception_with_invalid_shard_name.rb
|
317
|
+
- spec/migrations/7_raise_exception_with_invalid_multiple_shard_names.rb
|
318
|
+
- spec/migrations/8_raise_exception_with_invalid_group_name.rb
|
319
|
+
- spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb
|
320
|
+
- spec/octopus/association_shard_tracking_spec.rb
|
321
|
+
- spec/octopus/collection_proxy_spec.rb
|
322
|
+
- spec/octopus/load_balancing/round_robin_spec.rb
|
323
|
+
- spec/octopus/log_subscriber_spec.rb
|
324
|
+
- spec/octopus/migration_spec.rb
|
325
|
+
- spec/octopus/model_spec.rb
|
326
|
+
- spec/octopus/octopus_spec.rb
|
327
|
+
- spec/octopus/proxy_spec.rb
|
328
|
+
- spec/octopus/query_cache_for_shards_spec.rb
|
329
|
+
- spec/octopus/relation_proxy_spec.rb
|
330
|
+
- spec/octopus/replicated_slave_grouped_spec.rb
|
331
|
+
- spec/octopus/replication_spec.rb
|
332
|
+
- spec/octopus/scope_proxy_spec.rb
|
333
|
+
- spec/octopus/sharded_replicated_slave_grouped_spec.rb
|
334
|
+
- spec/octopus/sharded_spec.rb
|
335
|
+
- spec/spec_helper.rb
|
336
|
+
- spec/support/active_record/connection_adapters/modify_config_adapter.rb
|
337
|
+
- spec/support/database_connection.rb
|
338
|
+
- spec/support/database_models.rb
|
339
|
+
- spec/support/octopus_helper.rb
|
340
|
+
- spec/support/query_count.rb
|
341
|
+
- spec/support/shared_contexts.rb
|
342
|
+
- spec/tasks/octopus.rake_spec.rb
|
184
343
|
homepage: https://github.com/tchandy/octopus
|
185
344
|
licenses:
|
186
345
|
- MIT
|
@@ -200,13 +359,52 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
359
|
version: 2.1.0
|
201
360
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
361
|
requirements:
|
203
|
-
- - "
|
362
|
+
- - ">="
|
204
363
|
- !ruby/object:Gem::Version
|
205
|
-
version:
|
364
|
+
version: '0'
|
206
365
|
requirements: []
|
207
366
|
rubyforge_project:
|
208
367
|
rubygems_version: 2.7.6
|
209
368
|
signing_key:
|
210
369
|
specification_version: 4
|
211
370
|
summary: Easy Database Sharding for ActiveRecord
|
212
|
-
test_files:
|
371
|
+
test_files:
|
372
|
+
- spec/config/shards.yml
|
373
|
+
- spec/migrations/10_create_users_using_replication.rb
|
374
|
+
- spec/migrations/11_add_field_in_all_slaves.rb
|
375
|
+
- spec/migrations/12_create_users_using_block.rb
|
376
|
+
- spec/migrations/13_create_users_using_block_and_using.rb
|
377
|
+
- spec/migrations/14_create_users_on_shards_of_a_group_with_versions.rb
|
378
|
+
- spec/migrations/15_create_user_on_shards_of_default_group_with_versions.rb
|
379
|
+
- spec/migrations/1_create_users_on_master.rb
|
380
|
+
- spec/migrations/2_create_users_on_canada.rb
|
381
|
+
- spec/migrations/3_create_users_on_both_shards.rb
|
382
|
+
- spec/migrations/4_create_users_on_shards_of_a_group.rb
|
383
|
+
- spec/migrations/5_create_users_on_multiples_groups.rb
|
384
|
+
- spec/migrations/6_raise_exception_with_invalid_shard_name.rb
|
385
|
+
- spec/migrations/7_raise_exception_with_invalid_multiple_shard_names.rb
|
386
|
+
- spec/migrations/8_raise_exception_with_invalid_group_name.rb
|
387
|
+
- spec/migrations/9_raise_exception_with_multiple_invalid_group_names.rb
|
388
|
+
- spec/octopus/association_shard_tracking_spec.rb
|
389
|
+
- spec/octopus/collection_proxy_spec.rb
|
390
|
+
- spec/octopus/load_balancing/round_robin_spec.rb
|
391
|
+
- spec/octopus/log_subscriber_spec.rb
|
392
|
+
- spec/octopus/migration_spec.rb
|
393
|
+
- spec/octopus/model_spec.rb
|
394
|
+
- spec/octopus/octopus_spec.rb
|
395
|
+
- spec/octopus/proxy_spec.rb
|
396
|
+
- spec/octopus/query_cache_for_shards_spec.rb
|
397
|
+
- spec/octopus/relation_proxy_spec.rb
|
398
|
+
- spec/octopus/replicated_slave_grouped_spec.rb
|
399
|
+
- spec/octopus/replication_spec.rb
|
400
|
+
- spec/octopus/scope_proxy_spec.rb
|
401
|
+
- spec/octopus/sharded_replicated_slave_grouped_spec.rb
|
402
|
+
- spec/octopus/sharded_spec.rb
|
403
|
+
- spec/spec_helper.rb
|
404
|
+
- spec/support/active_record/connection_adapters/modify_config_adapter.rb
|
405
|
+
- spec/support/database_connection.rb
|
406
|
+
- spec/support/database_models.rb
|
407
|
+
- spec/support/octopus_helper.rb
|
408
|
+
- spec/support/query_count.rb
|
409
|
+
- spec/support/shared_contexts.rb
|
410
|
+
- spec/tasks/octopus.rake_spec.rb
|