Class: PgExport::Operations::RemoveOldDumpsFromFtp

Inherits:
Object
  • Object
show all
Includes:
Dry::Transaction::Operation
Defined in:
lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb

Instance Method Summary collapse

Instance Method Details

#call(dump:, ftp_adapter:) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp.rb', line 12

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