Parent

Class/Module Index [+]

Quicksearch

Sequel::ConnectionPool

The base connection pool class, which all other connection pools are built on. This class is not instantiated directly, but subclasses should at the very least implement the following API:

For sharded connection pools, the sharded API:

Constants

CONNECTION_POOL_MAP

A map of [single threaded, sharded] values to files (indicating strings to be required) ConnectionPool subclasses.

DEFAULT_SERVER

The default server to use

Public Class Methods

new(opts={}, &block) click to toggle source

Instantiates a connection pool with the given options. The block is called with a single symbol (specifying the server/shard to use) every time a new connection is needed. The following options are respected for all connection pools:

  • :after_connect - The proc called after each new connection is made, with the connection object, useful for customizations that you want to apply to all connections.

  • :disconnection_proc - The proc called when removing connections from the pool, which is passed the connection to disconnect.

# File lib/sequel/connection_pool.rb, line 69
def initialize(opts={}, &block)
  raise(Sequel::Error, "No connection proc specified") unless @connection_proc = block
  @disconnection_proc = opts[:disconnection_proc]
  @after_connect = opts[:after_connect]
end

Public Instance Methods

created_count(*args) click to toggle source

Alias for size, not aliased directly for ease of subclass implementation

# File lib/sequel/connection_pool.rb, line 76
def created_count(*args)
  size(*args)
end
servers() click to toggle source

An array of symbols for all shards/servers, which is a single :default by default.

# File lib/sequel/connection_pool.rb, line 81
def servers
  [:default]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.