Method: Sequel::ShardedSingleConnectionPool#initialize

Defined in:
lib/sequel/connection_pool/sharded_single.rb

#initialize(db, opts = OPTS) ⇒ ShardedSingleConnectionPool

The single threaded pool takes the following options:

:servers

A hash of servers to use. Keys should be symbols. If not present, will use a single :default server.

:servers_hash

The base hash to use for the servers. By default, Sequel uses Hash.new(:default). You can use a hash with a default proc that raises an error if you want to catch all cases where a nonexistent server is used.

[View source]

14
15
16
17
18
19
20
# File 'lib/sequel/connection_pool/sharded_single.rb', line 14

def initialize(db, opts=OPTS)
  super
  @conns = {}
  @servers = opts.fetch(:servers_hash, Hash.new(:default))
  add_servers([:default])
  add_servers(opts[:servers].keys) if opts[:servers]
end