Class: Familia::Connection::BaseConnectionHandler
- Inherits:
-
Object
- Object
- Familia::Connection::BaseConnectionHandler
- Defined in:
- lib/familia/connection/handlers.rb
Overview
Connection handler base class for Chain of Responsibility pattern. When no arguments are passed, all behaviour is based on the top Familia module itself. e.g. Familia.create_dbclient.
Summary of Behaviors
| Handler | Transaction | Pipeline | Ad-hoc Commands | |---------|------------|----------|-----------------| | FiberTransaction | Reentrant (same conn) | Error | Use transaction conn | | FiberConnection | Error | Error | ✓ Allowed | | Provider | ✓ New checkout | ✓ New checkout | ✓ New checkout | | Default | ✓ With guards | ✓ With guards | ✓ Check mode | | Create | ✓ Fresh conn | ✓ Fresh conn | ✓ Fresh conn |
NOTE: Every subclass must provide values for the @allows_transaction and @allows_pipelined attributes.
Direct Known Subclasses
CachedConnectionHandler, CreateConnectionHandler, FiberConnectionHandler, FiberTransactionHandler, ParentDelegationHandler, ProviderConnectionHandler, StandaloneConnectionHandler
Class Attribute Summary collapse
-
.allows_pipelined ⇒ Object
readonly
Returns the value of attribute allows_pipelined.
-
.allows_transaction ⇒ Object
readonly
Returns the value of attribute allows_transaction.
Instance Method Summary collapse
- #handle(uri) ⇒ Object
-
#initialize(familia_module = nil) ⇒ BaseConnectionHandler
constructor
A new instance of BaseConnectionHandler.
Constructor Details
#initialize(familia_module = nil) ⇒ BaseConnectionHandler
Returns a new instance of BaseConnectionHandler.
66 67 68 |
# File 'lib/familia/connection/handlers.rb', line 66 def initialize(familia_module = nil) @familia_module = familia_module || Familia end |
Class Attribute Details
.allows_pipelined ⇒ Object (readonly)
Returns the value of attribute allows_pipelined.
63 64 65 |
# File 'lib/familia/connection/handlers.rb', line 63 def allows_pipelined @allows_pipelined end |
.allows_transaction ⇒ Object (readonly)
Returns the value of attribute allows_transaction.
63 64 65 |
# File 'lib/familia/connection/handlers.rb', line 63 def allows_transaction @allows_transaction end |
Instance Method Details
#handle(uri) ⇒ Object
70 71 72 |
# File 'lib/familia/connection/handlers.rb', line 70 def handle(uri) raise NotImplementedError, 'Subclasses must implement handle' end |