module Sequel::ServerBlock

  1. lib/sequel/extensions/server_block.rb

Methods

Public Class

  1. extended

Public Instance

  1. with_server

Public Class methods

extended(db)

Enable the server block on the connection pool, choosing the correct extension depending on whether the connection pool is threaded or not. Also defines the with_server method on the receiver for easy use.

[show source]
   # File lib/sequel/extensions/server_block.rb
70 def self.extended(db)
71   pool = db.pool
72   case pool.pool_type
73   when :sharded_threaded, :sharded_timed_queue
74     pool.extend(ThreadedServerBlock)
75     pool.instance_variable_set(:@default_servers, {})
76   else
77     pool.extend(UnthreadedServerBlock)
78     pool.instance_variable_set(:@default_servers, [])
79   end
80 end

Public Instance methods

with_server(default_server, read_only_server=default_server, &block)

Delegate to the connection pool

[show source]
   # File lib/sequel/extensions/server_block.rb
83 def with_server(default_server, read_only_server=default_server, &block)
84   pool.with_server(default_server, read_only_server, &block)
85 end