Sha256: fed74d1d21a890f84358cd1e17ca0de9937a6e00578ad8824f5624a36dd224e5

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

require 'dry/transaction/operation'
require 'pg_export/import'

class PgExport
  module Operations
    class RemoveOldDumpsFromFtp
      include Dry::Transaction::Operation
      include Import['repositories.gateway_dump_repository', 'config']

      def call(dump:, gateway:)
        dumps = gateway_dump_repository.by_database_name(
          database_name: dump.database,
          gateway: gateway,
          offset: config.keep_dumps
        )
        dumps.each do |d|
          gateway.delete(d.name)
        end

        Success(removed_dumps: dumps, gateway: gateway)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pg_export-1.0.0.rc3 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb
pg_export-1.0.0.rc2 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb
pg_export-1.0.0.rc1 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb