class ActiveRecord::ConnectionAdapters::PoolManager

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/active_record/connection_adapters/pool_manager.rbs

class ActiveRecord::ConnectionAdapters::PoolManager
  def get_pool_config: (Symbol role, Symbol shard) -> ActiveRecord::ConnectionAdapters::PoolConfig
  def pool_configs: (?Symbol? role) -> untyped
  def role_names: () -> untyped
  def set_pool_config: (Symbol role, Symbol shard, ActiveRecord::ConnectionAdapters::PoolConfig pool_config) -> ActiveRecord::ConnectionAdapters::PoolConfig
  def shard_names: () -> untyped
end

:nodoc:

def get_pool_config(role, shard)

Experimental RBS support (using type sampling data from the type_fusion project).

def get_pool_config: (Symbol role, Symbol shard) -> ActiveRecord::ConnectionAdapters::PoolConfig

This signature was generated using 76 samples from 3 applications.

def get_pool_config(role, shard)
  @name_to_role_mapping[role][shard]
end

def initialize

:nodoc:
def initialize
  @name_to_role_mapping = Hash.new { |h, k| h[k] = {} }
end

def pool_configs(role = nil)

Experimental RBS support (using type sampling data from the type_fusion project).

def pool_configs: (?Symbol? role) -> untyped

This signature was generated using 53 samples from 1 application.

def pool_configs(role = nil)
  if role
    @name_to_role_mapping[role].values
  else
    @name_to_role_mapping.flat_map { |_, shard_map| shard_map.values }
  end
end

def remove_pool_config(role, shard)

def remove_pool_config(role, shard)
  @name_to_role_mapping[role].delete(shard)
end

def remove_role(role)

def remove_role(role)
  @name_to_role_mapping.delete(role)
end

def role_names

Experimental RBS support (using type sampling data from the type_fusion project).

def role_names: () -> untyped

This signature was generated using 10 samples from 1 application.

def role_names
  @name_to_role_mapping.keys
end

def set_pool_config(role, shard, pool_config)

Experimental RBS support (using type sampling data from the type_fusion project).

def set_pool_config: (Symbol role, Symbol shard, ActiveRecord::ConnectionAdapters::PoolConfig pool_config) -> ActiveRecord::ConnectionAdapters::PoolConfig

This signature was generated using 1 sample from 1 application.

def set_pool_config(role, shard, pool_config)
  if pool_config
    @name_to_role_mapping[role][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

def shard_names

Experimental RBS support (using type sampling data from the type_fusion project).

def shard_names: () -> untyped

This signature was generated using 5 samples from 1 application.

def shard_names
  @name_to_role_mapping.values.flat_map { |shard_map| shard_map.keys }
end