Class: Familia::Connection::FiberPipelineHandler

Inherits:
Object
  • Object
show all
Includes:
Handler
Defined in:
lib/familia/connection/handlers.rb

Overview

Checks for fiber-local pipeline connections

Returns the fiber-local pipeline connection when inside a pipelined block. Raises ConflictingContextError if both pipeline and transaction contexts are active — these are mutually exclusive operations.

Reentrant pipeline - just yield the existing connection No new pipeline block, just participate in existing pipeline

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.instanceObject (readonly)

Returns the value of attribute instance.



216
217
218
# File 'lib/familia/connection/handlers.rb', line 216

def instance
  @instance
end

Instance Method Details

#handle(_uri) ⇒ Object



219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/familia/connection/handlers.rb', line 219

def handle(_uri)
  return nil unless Fiber[:familia_pipeline]

  if Fiber[:familia_transaction]
    Familia.trace :CONFLICTING_CONTEXT, _uri,
                 'Pipeline handler detected active transaction context'
    raise Familia::ConflictingContextError,
      'Cannot mix pipeline and transaction contexts. ' \
      'Restructure to use one or the other.'
  end

  Familia.trace :DBCLIENT_FIBER_PIPELINE, nil, 'Using fiber-local pipeline connection'
  Fiber[:familia_pipeline]
end