Class: Familia::Connection::ProviderConnectionHandler
- Inherits:
-
BaseConnectionHandler
- Object
- BaseConnectionHandler
- Familia::Connection::ProviderConnectionHandler
- Defined in:
- lib/familia/connection/handlers.rb
Overview
Delegates to user-defined connection provider
Provider pattern = full flexibility. Use ad-hoc, operations, whatever you like. For each connection, choose one and then get another connection. Rapid-fire sub ms connection pool connection checkouts are all good and also expected how they are to be used. This is where connection pools live
Instance Method Summary collapse
Constructor Details
This class inherits a constructor from Familia::Connection::BaseConnectionHandler
Instance Method Details
#handle(uri) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/familia/connection/handlers.rb', line 108 def handle(uri) return nil unless @familia_module.connection_provider @familia_module.trace :DBCLIENT_PROVIDER, nil, 'Using connection provider' # Determine the correct URI including logical database if needed if uri.nil? && @familia_module.respond_to?(:logical_database) && @familia_module.logical_database uri = @familia_module.logical_database end # Always pass normalized URI with database to provider # Provider MUST return connection already on the correct database parsed_uri = @familia_module.normalize_uri(uri) @familia_module.connection_provider.call(parsed_uri.to_s) end |