Class | Sequel::ConnectionPool |
In: |
lib/sequel/connection_pool.rb
|
Parent: | Object |
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:
DEFAULT_SERVER | = | :default | The default server to use | |
CONNECTION_POOL_MAP | = | {[true, false] => :single, [true, true] => :sharded_single, [false, false] => :threaded, [false, true] => :sharded_threaded} | A map of [single threaded, sharded] values to files (indicating strings to be required) ConnectionPool subclasses. |
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:
# File lib/sequel/connection_pool.rb, line 69 69: def initialize(opts={}, &block) 70: raise(Sequel::Error, "No connection proc specified") unless @connection_proc = block 71: @disconnection_proc = opts[:disconnection_proc] 72: @after_connect = opts[:after_connect] 73: end