Sha256: 5421188a055d2f337331402323a6b9f37873d443ed4a70c6e364b0184753fbeb

Contents?: true

Size: 1.09 KB

Versions: 25

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true
module Dynflow
  module CoordinatorAdapters
    class Sequel < Abstract
      def initialize(world)
        super
        @sequel_adapter = world.persistence.adapter
        Type! @sequel_adapter, PersistenceAdapters::Sequel
      end

      def create_record(record)
        @sequel_adapter.insert_coordinator_record(record.to_hash)
      rescue Errors::PersistenceError => e
        if e.cause.is_a? ::Sequel::UniqueConstraintViolation
          raise Coordinator::DuplicateRecordError.new(record)
        else
          raise e
        end
      end

      def update_record(record)
        @sequel_adapter.update_coordinator_record(record.class.name, record.id, record.to_hash)
      end

      def delete_record(record)
        @sequel_adapter.delete_coordinator_record(record.class.name, record.id)
      end

      def find_records(filter_options)
        @sequel_adapter.find_coordinator_records(filters: filter_options)
      end

      def find_execution_plans(filter_options)
        @sequel_adapter.find_execution_plans(filters: filter_options)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
dynflow-1.8.2 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.8.1 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.8.0 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.7.0 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.11 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.10 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.8 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.7 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.6 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.5 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.4 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.3 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.2 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.6.1 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.4.9 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.4.8 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.5.0 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.4.7 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.4.6 lib/dynflow/coordinator_adapters/sequel.rb
dynflow-1.4.5 lib/dynflow/coordinator_adapters/sequel.rb