Last Modified
  2023-12-22 04:32:30 +0000
Requires

## Description

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:

- initialize(Hash, &block) - The block is used as the connection proc, which should accept a single symbol argument.

- hold(Symbol, &block) - yield a connection object (obtained from calling the block passed to initialize) to the current block. For sharded connection pools, the Symbol passed is the shard/server to use.

- disconnect(Symbol, &block) - disconnect the connection object. If a block is given, pass the connection option to it, otherwise use the :disconnection_proc option in the hash passed to initialize. For sharded connection pools, the Symbol passed is the shard/server to use.

- servers - an array of shard/server symbols for all shards/servers that this connection pool recognizes.

- size - an integer representing the total number of connections in the pool, or for the given shard/server if sharding is supported.

For sharded connection pools, the sharded API:

- add_servers(Array of Symbols) - start recognizing all shards/servers specified by the array of symbols.

- remove_servers(Array of Symbols) - no longer recognize all shards/servers specified by the array of symbols.