Module: Familia::Connection::Handler
- Included in:
- CachedConnectionHandler, CreateConnectionHandler, FiberConnectionHandler, FiberPipelineHandler, FiberTransactionHandler, ParentDelegationHandler, ProviderConnectionHandler, StandaloneConnectionHandler
- Defined in:
- lib/familia/connection/handlers.rb
Overview
Shared interface for connection handlers in the Chain of Responsibility.
Including this module gives a handler class:
- an instance-side
handle(uri)stub that raises NotImplementedError, and - a small class-level DSL (
supports) for declaring capability flags (allows_transaction,allows_pipelined) read by the operation guards in TransactionCore and PipelinedCore.
Capability flags default to nil when supports is not called — there
is no implicit "allow all". Every handler is expected to declare its
capabilities explicitly.
Summary of behaviours of the in-tree handlers:
| Handler | Transaction | Pipeline | Ad-hoc Commands | |--------------------|-------------------|----------------------|----------------------| | FiberPipeline | Error | Reentrant (same conn)| Use pipeline conn | | FiberTransaction | Reentrant | Error | Use transaction conn | | FiberConnection | Error | Error | Allowed | | Provider | New checkout | New checkout | New checkout | | Cached | Error | Error | Allowed | | Create / Default | Fresh conn | Fresh conn | Fresh conn | | ParentDelegation | Delegated | Delegated | Delegated | | Standalone | Allowed | Allowed | Allowed |
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#handle(_uri) ⇒ Object
72 73 74 |
# File 'lib/familia/connection/handlers.rb', line 72 def handle(_uri) raise NotImplementedError, 'Subclasses must implement handle' end |