module DirtyPipeline
Constants
- Queue
def self.with_postgres
yield(ActiveRecord::Base.connection.raw_connection)
ensure
ActiveRecord::Base.clear_active_connections!
end
- Railway
- Storage
- VERSION
Public Class Methods
create!(conn)
click to toggle source
# File lib/dirty_pipeline.rb, line 53 def self.create!(conn) Queue.create!(conn) if Queue.respond_to?(:create!) Storage.create!(conn) if Storage.respond_to?(:create!) Railway.create!(conn) if Railway.respond_to?(:create!) end
destroy!(conn)
click to toggle source
# File lib/dirty_pipeline.rb, line 59 def self.destroy!(conn) Queue.destroy!(conn) if Queue.respond_to?(:destroy!) Storage.destroy!(conn) if Storage.respond_to?(:destroy!) Railway.destroy!(conn) if Railway.respond_to?(:destroy!) end
with_postgres()
click to toggle source
This method should yield raw PG
connection
# File lib/dirty_pipeline.rb, line 31 def self.with_postgres fail NotImplementedError end
with_postgres_transaction() { |transaction_conn| ... }
click to toggle source
# File lib/dirty_pipeline.rb, line 35 def self.with_postgres_transaction with_postgres do |conn| conn.transaction do |transaction_conn| yield transaction_conn end end end
with_redis()
click to toggle source
This method should yield raw Redis
connection
# File lib/dirty_pipeline.rb, line 26 def self.with_redis fail NotImplementedError end