Sha256: aaca288bc4ef7cb5157e5a21971736cc4b86fa2075db45fce634be98f9eac123

Contents?: true

Size: 1.01 KB

Versions: 69

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    class LegacyPoolManager # :nodoc:
      def initialize
        @name_to_pool_config = {}
      end

      def shard_names
        @name_to_pool_config.keys
      end

      def pool_configs(_ = nil)
        @name_to_pool_config.values
      end

      def remove_pool_config(_, shard)
        @name_to_pool_config.delete(shard)
      end

      def get_pool_config(_, shard)
        @name_to_pool_config[shard]
      end

      def set_pool_config(role, shard, pool_config)
        if pool_config
          @name_to_pool_config[shard] = pool_config
        else
          raise ArgumentError, "The `pool_config` for the :#{role} role and :#{shard} shard was `nil`. Please check your configuration. If you want your writing role to be something other than `:writing` set `config.active_record.writing_role` in your application configuration. The same setting should be applied for the `reading_role` if applicable."
        end
      end
    end
  end
end

Version data entries

69 entries across 65 versions & 7 rubygems

Version Path
activerecord-7.0.8.6 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-6.1.7.10 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-6.1.7.9 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-7.0.8.5 lib/active_record/connection_adapters/legacy_pool_manager.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/legacy_pool_manager.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/connection_adapters/legacy_pool_manager.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/connection_adapters/legacy_pool_manager.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-7.0.8.4 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-6.1.7.8 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-7.0.8.1 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-6.1.7.7 lib/active_record/connection_adapters/legacy_pool_manager.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/legacy_pool_manager.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/legacy_pool_manager.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.2.3/lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-7.0.8 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-7.0.7.2 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-6.1.7.6 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-7.0.7.1 lib/active_record/connection_adapters/legacy_pool_manager.rb
activerecord-6.1.7.5 lib/active_record/connection_adapters/legacy_pool_manager.rb