Sha256: 4005dbffff22478440b7323c080884eb42b83907e0669ce14f8880cd3c0757f7

Contents?: true

Size: 652 Bytes

Versions: 5

Compression:

Stored size: 652 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.ftp_dump_repository', 'config']

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg_export-0.7.7 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb
pg_export-0.7.6 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb
pg_export-0.7.5 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb
pg_export-0.7.4 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb
pg_export-0.7.3 lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb