switchman 1.13.3 → 2.2.0

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/switchman/shard.rb +712 -11
  3. data/db/migrate/20130328212039_create_switchman_shards.rb +2 -0
  4. data/db/migrate/20130328224244_create_default_shard.rb +3 -1
  5. data/db/migrate/20161206323434_add_back_default_string_limits_switchman.rb +2 -0
  6. data/db/migrate/20180828183945_add_default_shard_index.rb +3 -1
  7. data/db/migrate/20180828192111_add_timestamps_to_shards.rb +2 -0
  8. data/db/migrate/20190114212900_add_unique_name_indexes.rb +2 -0
  9. data/lib/switchman/action_controller/caching.rb +2 -0
  10. data/lib/switchman/active_record/abstract_adapter.rb +6 -4
  11. data/lib/switchman/active_record/association.rb +45 -16
  12. data/lib/switchman/active_record/attribute_methods.rb +43 -17
  13. data/lib/switchman/active_record/base.rb +60 -20
  14. data/lib/switchman/active_record/batches.rb +2 -0
  15. data/lib/switchman/active_record/calculations.rb +5 -2
  16. data/lib/switchman/active_record/connection_handler.rb +48 -25
  17. data/lib/switchman/active_record/connection_pool.rb +19 -15
  18. data/lib/switchman/active_record/finder_methods.rb +2 -0
  19. data/lib/switchman/active_record/log_subscriber.rb +10 -12
  20. data/lib/switchman/active_record/migration.rb +48 -2
  21. data/lib/switchman/active_record/model_schema.rb +3 -1
  22. data/lib/switchman/active_record/persistence.rb +13 -2
  23. data/lib/switchman/active_record/postgresql_adapter.rb +149 -139
  24. data/lib/switchman/active_record/predicate_builder.rb +3 -1
  25. data/lib/switchman/active_record/query_cache.rb +19 -107
  26. data/lib/switchman/active_record/query_methods.rb +25 -3
  27. data/lib/switchman/active_record/reflection.rb +21 -8
  28. data/lib/switchman/active_record/relation.rb +66 -10
  29. data/lib/switchman/active_record/spawn_methods.rb +2 -0
  30. data/lib/switchman/active_record/statement_cache.rb +6 -25
  31. data/lib/switchman/active_record/table_definition.rb +4 -2
  32. data/lib/switchman/active_record/type_caster.rb +2 -0
  33. data/lib/switchman/active_record/where_clause_factory.rb +2 -0
  34. data/lib/switchman/active_support/cache.rb +18 -0
  35. data/lib/switchman/arel.rb +2 -0
  36. data/lib/switchman/call_super.rb +2 -0
  37. data/lib/switchman/connection_pool_proxy.rb +44 -22
  38. data/lib/switchman/database_server.rb +34 -19
  39. data/lib/switchman/default_shard.rb +3 -0
  40. data/lib/switchman/engine.rb +20 -15
  41. data/lib/switchman/environment.rb +2 -0
  42. data/lib/switchman/errors.rb +2 -0
  43. data/lib/switchman/{shackles → guard_rail}/relation.rb +7 -5
  44. data/lib/switchman/{shackles.rb → guard_rail.rb} +6 -4
  45. data/lib/switchman/open4.rb +2 -0
  46. data/lib/switchman/r_spec_helper.rb +9 -7
  47. data/lib/switchman/rails.rb +2 -0
  48. data/lib/switchman/schema_cache.rb +11 -1
  49. data/lib/switchman/sharded_instrumenter.rb +3 -1
  50. data/lib/switchman/standard_error.rb +3 -1
  51. data/lib/switchman/test_helper.rb +7 -11
  52. data/lib/switchman/version.rb +3 -1
  53. data/lib/switchman.rb +5 -1
  54. data/lib/tasks/switchman.rake +24 -17
  55. metadata +53 -26
  56. data/app/models/switchman/shard_internal.rb +0 -714
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace Switchman
@@ -87,13 +89,13 @@ module Switchman
87
89
  require "switchman/arel"
88
90
  require "switchman/call_super"
89
91
  require "switchman/rails"
90
- require "switchman/shackles/relation"
91
- require_dependency "switchman/shard_internal"
92
+ require "switchman/guard_rail/relation"
93
+ require_dependency "switchman/shard"
92
94
  require "switchman/standard_error"
93
95
 
94
96
  ::StandardError.include(StandardError)
95
97
 
96
- include ActiveRecord::Base
98
+ prepend ActiveRecord::Base
97
99
  include ActiveRecord::AttributeMethods
98
100
  include ActiveRecord::Persistence
99
101
  singleton_class.prepend ActiveRecord::ModelSchema::ClassMethods
@@ -118,15 +120,11 @@ module Switchman
118
120
  ::ActiveRecord::ConnectionAdapters::ConnectionHandler.prepend(ActiveRecord::ConnectionHandler)
119
121
  ::ActiveRecord::ConnectionAdapters::ConnectionPool.prepend(ActiveRecord::ConnectionPool)
120
122
  ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(ActiveRecord::QueryCache)
121
- # when we call super in Switchman::ActiveRecord::QueryCache#select_all,
122
- # we want it to find the definition from
123
- # ActiveRecord::ConnectionAdapters::DatabaseStatements, not
124
- # ActiveRecord::ConnectionAdapters::QueryCache
125
- ::ActiveRecord::ConnectionAdapters::QueryCache.send(:remove_method, :select_all) if ::Rails.version < '5.0.1'
126
123
 
127
124
  ::ActiveRecord::LogSubscriber.prepend(ActiveRecord::LogSubscriber)
128
125
  ::ActiveRecord::Migration.prepend(ActiveRecord::Migration)
129
126
  ::ActiveRecord::Migration::Compatibility::V5_0.prepend(ActiveRecord::Migration::Compatibility::V5_0)
127
+ ::ActiveRecord::MigrationContext.prepend(ActiveRecord::MigrationContext) if ::Rails.version >= '5.2'
130
128
  ::ActiveRecord::Migrator.prepend(ActiveRecord::Migrator)
131
129
 
132
130
  ::ActiveRecord::Reflection::AbstractReflection.include(ActiveRecord::Reflection::AbstractReflection)
@@ -137,13 +135,14 @@ module Switchman
137
135
  ::ActiveRecord::Relation.prepend(ActiveRecord::Calculations)
138
136
  ::ActiveRecord::Relation.include(ActiveRecord::FinderMethods)
139
137
  ::ActiveRecord::Relation.include(ActiveRecord::QueryMethods)
140
- ::ActiveRecord::Relation.prepend(Shackles::Relation)
138
+ ::ActiveRecord::Relation.prepend(GuardRail::Relation)
141
139
  ::ActiveRecord::Relation.prepend(ActiveRecord::Relation)
142
140
  ::ActiveRecord::Relation.include(ActiveRecord::SpawnMethods)
143
141
  ::ActiveRecord::Relation.include(CallSuper)
144
142
 
145
143
  ::ActiveRecord::Relation::WhereClauseFactory.prepend(ActiveRecord::WhereClauseFactory)
146
144
  ::ActiveRecord::PredicateBuilder::AssociationQueryValue.prepend(ActiveRecord::PredicateBuilder::AssociationQueryValue)
145
+ ::ActiveRecord::PredicateBuilder::PolymorphicArrayValue.prepend(ActiveRecord::PredicateBuilder::AssociationQueryValue)
147
146
  ::ActiveRecord::TypeCaster::Map.include(ActiveRecord::TypeCaster::Map)
148
147
  ::ActiveRecord::TypeCaster::Connection.include(ActiveRecord::TypeCaster::Connection)
149
148
 
@@ -154,8 +153,8 @@ module Switchman
154
153
  end
155
154
  end
156
155
 
157
- def self.foreign_key_check(name, type, options)
158
- if name.to_s =~ /_id\z/ && type.to_s == 'integer' && options[:limit].to_i < 8
156
+ def self.foreign_key_check(name, type, limit: nil)
157
+ if name.to_s =~ /_id\z/ && type.to_s == 'integer' && limit.to_i < 8
159
158
  puts "WARNING: All foreign keys need to be 8-byte integers. #{name} looks like a foreign key. If so, please add the option: `:limit => 8`"
160
159
  end
161
160
  end
@@ -173,6 +172,12 @@ module Switchman
173
172
  require "switchman/active_record/postgresql_adapter"
174
173
  ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(ActiveRecord::PostgreSQLAdapter)
175
174
  end
175
+
176
+ # If Switchman::Shard wasn't loaded as of when ActiveRecord::Base initialized
177
+ # establish a connection here instead
178
+ if !Shard.instance_variable_get(:@default)
179
+ ::ActiveRecord::Base.establish_connection
180
+ end
176
181
  end
177
182
  end
178
183
 
@@ -183,15 +188,15 @@ module Switchman
183
188
  end
184
189
  end
185
190
 
186
- initializer 'switchman.extend_shackles', :before => "switchman.extend_ar" do
191
+ initializer 'switchman.extend_guard_rail', :before => "switchman.extend_ar" do
187
192
  ::ActiveSupport.on_load(:active_record) do
188
- require "switchman/shackles"
193
+ require "switchman/guard_rail"
189
194
 
190
- ::Shackles.singleton_class.prepend(Shackles::ClassMethods)
195
+ ::GuardRail.singleton_class.prepend(GuardRail::ClassMethods)
191
196
  end
192
197
  end
193
198
 
194
- initializer 'switchman.extend_controller', :after => "shackles.extend_ar" do
199
+ initializer 'switchman.extend_controller', :after => "guard_rail.extend_ar" do
195
200
  ::ActiveSupport.on_load(:action_controller) do
196
201
  require "switchman/action_controller/caching"
197
202
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'etc'
2
4
 
3
5
  module Switchman
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
4
  class NonExistentShardError < RuntimeError; end
3
5
  class ParallelShardExecError < RuntimeError; end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
- module Shackles
4
+ module GuardRail
3
5
  module Relation
4
6
  def exec_queries(*args)
5
7
  if self.lock_value
6
8
  db = Shard.current(shard_category).database_server
7
- if ::Shackles.environment != db.shackles_environment
8
- return db.unshackle { super }
9
+ if ::GuardRail.environment != db.guard_rail_environment
10
+ return db.unguard { super }
9
11
  end
10
12
  end
11
13
  super
@@ -15,8 +17,8 @@ module Switchman
15
17
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
16
18
  def #{method}(*args)
17
19
  db = Shard.current(shard_category).database_server
18
- if ::Shackles.environment != db.shackles_environment
19
- db.unshackle { super }
20
+ if ::GuardRail.environment != db.guard_rail_environment
21
+ db.unguard { super }
20
22
  else
21
23
  super
22
24
  end
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
- module Shackles
4
+ module GuardRail
3
5
  module ClassMethods
4
6
  def self.prepended(klass)
5
7
  klass.send(:remove_method, :ensure_handler)
6
8
  end
7
9
 
8
10
  # drops the save_handler and ensure_handler calls from the vanilla
9
- # Shackles' implementation.
11
+ # GuardRail' implementation.
10
12
  def activate!(environment)
11
- environment ||= :master
13
+ environment ||= :primary
12
14
  activated_environments << environment
13
15
  old_environment = self.environment
14
- Thread.current[:shackles_environment] = environment
16
+ Thread.current[:guard_rail_environment] = environment
15
17
  old_environment
16
18
  end
17
19
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open4'
2
4
 
3
5
  # This fixes a bug with exception handling,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "switchman/test_helper"
2
4
 
3
5
  module Switchman
@@ -65,7 +67,7 @@ module Switchman
65
67
  (@@shard3.drop_database if @@shard3) rescue nil
66
68
  @@shard1 = @@shard2 = @@shard3 = nil
67
69
  Shard.delete_all
68
- Shard.default(true)
70
+ Shard.default(reload: true)
69
71
  next
70
72
  end
71
73
  end
@@ -73,7 +75,7 @@ module Switchman
73
75
  # in the db before then
74
76
  Shard.delete_all
75
77
  Switchman.cache.delete("default_shard")
76
- Shard.default(true)
78
+ Shard.default(reload: true)
77
79
  puts "Done!"
78
80
 
79
81
  at_exit do
@@ -102,7 +104,7 @@ module Switchman
102
104
  dup.id = @@default_shard.id
103
105
  dup.save!
104
106
  Switchman.cache.delete("default_shard")
105
- Shard.default(true)
107
+ Shard.default(reload: true)
106
108
  dup = @@shard1.dup
107
109
  dup.id = @@shard1.id
108
110
  dup.save!
@@ -121,8 +123,8 @@ module Switchman
121
123
  klass.before do
122
124
  raise "Sharding did not set up correctly" if @@sharding_failed
123
125
  Shard.clear_cache
124
- if ::Rails.version >= '5.1' ? use_transactional_tests : (use_transactional_tests || use_transactional_fixtures)
125
- Shard.default(true)
126
+ if use_transactional_tests
127
+ Shard.default(reload: true)
126
128
  @shard1 = Shard.find(@shard1.id)
127
129
  @shard2 = Shard.find(@shard2.id)
128
130
  shards = [@shard2]
@@ -137,7 +139,7 @@ module Switchman
137
139
 
138
140
  klass.after do
139
141
  next if @@sharding_failed
140
- if ::Rails.version >= '5.1' ? use_transactional_tests : (use_transactional_tests || use_transactional_fixtures)
142
+ if use_transactional_tests
141
143
  shards = [@shard2]
142
144
  shards << @shard1 unless @shard1.database_server == Shard.default.database_server
143
145
  shards.each do |shard|
@@ -151,7 +153,7 @@ module Switchman
151
153
  klass.after(:all) do
152
154
  Shard.connection.update("TRUNCATE #{Shard.quoted_table_name} CASCADE")
153
155
  Switchman.cache.delete("default_shard")
154
- Shard.default(true)
156
+ Shard.default(reload: true)
155
157
  end
156
158
  end
157
159
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman::Rails
2
4
  module ClassMethods
3
5
  def self.prepended(klass)
@@ -1,16 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
4
  class SchemaCache < ::ActiveRecord::ConnectionAdapters::SchemaCache
3
5
  delegate :connection, to: :pool
4
6
  attr_reader :pool
5
7
 
8
+ SHARED_IVS = %i{@columns @columns_hash @primary_keys @data_sources @indexes}.freeze
9
+
6
10
  def initialize(pool)
7
11
  @pool = pool
8
12
  super(nil)
9
13
  end
10
14
 
11
15
  def copy_values(other_cache)
16
+ SHARED_IVS.each do |iv|
17
+ instance_variable_get(iv).replace(other_cache.instance_variable_get(iv))
18
+ end
19
+ end
20
+
21
+ def copy_references(other_cache)
12
22
  # use the same cached values but still fall back to the correct pool
13
- [:@columns, :@columns_hash, :@primary_keys, :@data_sources].each do |iv|
23
+ SHARED_IVS.each do |iv|
14
24
  instance_variable_set(iv, other_cache.instance_variable_get(iv))
15
25
  end
16
26
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
4
  class ShardedInstrumenter < ::SimpleDelegator
3
5
  def initialize(instrumenter, shard_host)
@@ -14,7 +16,7 @@ module Switchman
14
16
  payload[:shard] = {
15
17
  database_server_id: shard.database_server.id,
16
18
  id: shard.id,
17
- env: shard.database_server.shackles_environment
19
+ env: shard.database_server.guard_rail_environment
18
20
  }
19
21
  end
20
22
  super name, payload
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
4
  module StandardError
3
5
  def initialize(*args)
@@ -6,7 +8,7 @@ module Switchman
6
8
  end
7
9
 
8
10
  def current_shard(category = :primary)
9
- @active_shards[category] || Shard.default
11
+ @active_shards&.[](category) || Shard.default
10
12
  end
11
13
  end
12
14
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
4
  module TestHelper
3
5
  class << self
4
6
  def recreate_persistent_test_shards(dont_create: false)
5
7
  # recreate the default shard (it got buhleted)
6
- ::Shackles.activate(:deploy) { Switchman.cache.clear }
7
- if Shard.default(true).is_a?(DefaultShard)
8
+ ::GuardRail.activate(:deploy) { Switchman.cache.clear }
9
+ if Shard.default(reload: true).is_a?(DefaultShard)
8
10
  begin
9
11
  Shard.create!(default: true)
10
12
  rescue
@@ -12,17 +14,11 @@ module Switchman
12
14
  # database doesn't exist yet, presumably cause we're creating it right now
13
15
  return [nil, nil]
14
16
  end
15
- Shard.default(true)
17
+ Shard.default(reload: true)
16
18
  end
17
19
 
18
- # can't auto-create a new shard on the default shard's db server if the
19
- # default shard is split across multiple db servers
20
- if ::ActiveRecord::Base.connection_handler.connection_pool_list.length > 1
21
- server1 = DatabaseServer.create(Shard.default.database_server.config)
22
- else
23
- server1 = Shard.default.database_server
24
- end
25
- server2 = DatabaseServer.create(Shard.default.database_server.config)
20
+ server1 = Shard.default.database_server
21
+ server2 = DatabaseServer.create(Shard.default.database_server.config.merge(server2: true))
26
22
 
27
23
  if server1 == Shard.default.database_server && server1.config[:shard1] && server1.config[:shard2]
28
24
  # look for the shards in the db already
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
- VERSION = "1.13.3"
4
+ VERSION = "2.2.0"
3
5
  end
data/lib/switchman.rb CHANGED
@@ -1,4 +1,6 @@
1
- require "shackles"
1
+ # frozen_string_literal: true
2
+
3
+ require "guard_rail"
2
4
  require "switchman/open4"
3
5
  require "switchman/engine"
4
6
 
@@ -15,4 +17,6 @@ module Switchman
15
17
  def self.cache=(cache)
16
18
  @cache = cache
17
19
  end
20
+
21
+ class OrderOnMultiShardQuery < RuntimeError; end
18
22
  end
@@ -20,7 +20,12 @@ module Switchman
20
20
  open = servers.delete('open')
21
21
 
22
22
  servers = servers.map { |server| DatabaseServer.find(server) }.compact
23
- servers.concat(DatabaseServer.all.select { |server| server.config[:open] }) if open
23
+ if open
24
+ open_servers = DatabaseServer.all.select { |server| server.config[:open] }
25
+ servers.concat(open_servers)
26
+ servers << DatabaseServer.find(nil) if open_servers.empty?
27
+ servers.uniq!
28
+ end
24
29
  servers = DatabaseServer.all - servers if negative
25
30
  end
26
31
 
@@ -41,6 +46,7 @@ module Switchman
41
46
  end
42
47
 
43
48
  def self.options
49
+ # we still pass through both of these options for back-compat purposes
44
50
  { parallel: ENV['PARALLEL'].to_i, max_procs: ENV['MAX_PARALLEL_PROCS'] }
45
51
  end
46
52
 
@@ -59,16 +65,26 @@ module Switchman
59
65
  TestHelper.recreate_persistent_test_shards(dont_create: true)
60
66
  end
61
67
 
62
- ::Shackles.activate(:deploy) do
63
- Shard.default.database_server.unshackle do
68
+ ::GuardRail.activate(:deploy) do
69
+ Shard.default.database_server.unguard do
64
70
  begin
65
71
  categories = categories.call if categories.respond_to?(:call)
66
72
  Shard.with_each_shard(scope, categories, options) do
67
73
  shard = Shard.current
68
74
  puts "#{shard.id}: #{shard.description}"
69
75
  ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
70
- ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
71
- shard.database_server.unshackle do
76
+ if ::Rails.version < '6.0'
77
+ ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
78
+ else
79
+ # Adopted from the deprecated code that currently lives in rails proper
80
+ remaining_configs = ::ActiveRecord::Base.configurations.configurations.reject { |db_config| db_config.env_name == ::Rails.env }
81
+ new_config = ::ActiveRecord::DatabaseConfigurations.new(::Rails.env =>
82
+ ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys).configurations
83
+ new_configs = remaining_configs + new_config
84
+
85
+ ::ActiveRecord::Base.configurations = new_configs
86
+ end
87
+ shard.database_server.unguard do
72
88
  old_actions.each { |action| action.call(*task_args) }
73
89
  end
74
90
  nil
@@ -195,9 +211,7 @@ module Switchman
195
211
  @filter_database_servers_chain ||= ->(servers) { servers }
196
212
  end
197
213
  end
198
- end
199
214
 
200
- module Switchman
201
215
  module ActiveRecord
202
216
  module PostgreSQLDatabaseTasks
203
217
  def structure_dump(filename, extra_flags=nil)
@@ -205,16 +219,9 @@ module Switchman
205
219
  args = ['-s', '-x', '-O', '-f', filename]
206
220
  args.concat(Array(extra_flags)) if extra_flags
207
221
  search_path = configuration['schema_search_path']
208
- if configuration['use_qualified_names']
209
- shard = Shard.current.name
210
- serialized_search_path = shard
211
- args << "--schema=#{Shellwords.escape(shard)}"
212
- elsif !search_path.blank?
213
- args << search_path.split(',').map do |part|
214
- "--schema=#{part.strip}"
215
- end.join(' ')
216
- serialized_search_path = connection.schema_search_path
217
- end
222
+ shard = Shard.current.name
223
+ serialized_search_path = shard
224
+ args << "--schema=#{Shellwords.escape(shard)}"
218
225
 
219
226
  args << configuration['database']
220
227
  run_cmd('pg_dump', args, 'dumping')
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
8
8
  - James Williams
9
9
  - Jacob Fugal
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-05-14 00:00:00.000000000 Z
13
+ date: 2021-08-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -18,54 +18,54 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '5.0'
21
+ version: '5.1'
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '5.3'
24
+ version: '6.1'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: '5.0'
31
+ version: '5.1'
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '5.3'
34
+ version: '6.1'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: activerecord
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '5.0'
41
+ version: '5.1'
42
42
  - - "<"
43
43
  - !ruby/object:Gem::Version
44
- version: '5.3'
44
+ version: '6.1'
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: '5.0'
51
+ version: '5.1'
52
52
  - - "<"
53
53
  - !ruby/object:Gem::Version
54
- version: '5.3'
54
+ version: '6.1'
55
55
  - !ruby/object:Gem::Dependency
56
- name: shackles
56
+ name: guardrail
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.3'
61
+ version: 2.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.3'
68
+ version: 2.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: open4
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: pg
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +140,30 @@ dependencies:
126
140
  name: rspec-rails
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - '='
143
+ - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: 3.5.2
145
+ version: '3.5'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - '='
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.5'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec-mocks
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '3.5'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
137
165
  - !ruby/object:Gem::Version
138
- version: 3.5.2
166
+ version: '3.5'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: simplecov
141
169
  requirement: !ruby/object:Gem::Requirement
@@ -173,7 +201,6 @@ extra_rdoc_files: []
173
201
  files:
174
202
  - Rakefile
175
203
  - app/models/switchman/shard.rb
176
- - app/models/switchman/shard_internal.rb
177
204
  - db/migrate/20130328212039_create_switchman_shards.rb
178
205
  - db/migrate/20130328224244_create_default_shard.rb
179
206
  - db/migrate/20161206323434_add_back_default_string_limits_switchman.rb
@@ -215,12 +242,12 @@ files:
215
242
  - lib/switchman/engine.rb
216
243
  - lib/switchman/environment.rb
217
244
  - lib/switchman/errors.rb
245
+ - lib/switchman/guard_rail.rb
246
+ - lib/switchman/guard_rail/relation.rb
218
247
  - lib/switchman/open4.rb
219
248
  - lib/switchman/r_spec_helper.rb
220
249
  - lib/switchman/rails.rb
221
250
  - lib/switchman/schema_cache.rb
222
- - lib/switchman/shackles.rb
223
- - lib/switchman/shackles/relation.rb
224
251
  - lib/switchman/sharded_instrumenter.rb
225
252
  - lib/switchman/standard_error.rb
226
253
  - lib/switchman/test_helper.rb
@@ -230,7 +257,7 @@ homepage: http://www.instructure.com/
230
257
  licenses:
231
258
  - MIT
232
259
  metadata: {}
233
- post_install_message:
260
+ post_install_message:
234
261
  rdoc_options: []
235
262
  require_paths:
236
263
  - lib
@@ -238,15 +265,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
265
  requirements:
239
266
  - - ">="
240
267
  - !ruby/object:Gem::Version
241
- version: '2.3'
268
+ version: '2.5'
242
269
  required_rubygems_version: !ruby/object:Gem::Requirement
243
270
  requirements:
244
271
  - - ">="
245
272
  - !ruby/object:Gem::Version
246
273
  version: '0'
247
274
  requirements: []
248
- rubygems_version: 3.0.3
249
- signing_key:
275
+ rubygems_version: 3.2.24
276
+ signing_key:
250
277
  specification_version: 4
251
- summary: Rails 4 sharding magic
278
+ summary: Rails sharding magic
252
279
  test_files: []