Class: Familia::Connection::BaseConnectionHandler

Inherits:
Object
  • Object
show all
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.

Class Attribute Summary collapse

Instance Method Summary collapse

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_pipelinedObject (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_transactionObject (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

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/familia/connection/handlers.rb', line 70

def handle(uri)
  raise NotImplementedError, 'Subclasses must implement handle'
end