Class: PgExport

Inherits:
Object
  • Object
show all
Includes:
Concurrency
Defined in:
lib/pg_export.rb,
lib/pg_export/errors.rb,
lib/pg_export/logging.rb,
lib/pg_export/version.rb,
lib/pg_export/concurrency.rb,
lib/pg_export/configuration.rb,
lib/pg_export/services/utils.rb,
lib/pg_export/entities/sql_dump.rb,
lib/pg_export/entities/dump/base.rb,
lib/pg_export/services/ftp_service.rb,
lib/pg_export/services/dump_storage.rb,
lib/pg_export/entities/compressed_dump.rb,
lib/pg_export/entities/dump/size_human.rb,
lib/pg_export/services/ftp_service/connection.rb

Defined Under Namespace

Modules: Concurrency, Dump, Logging Classes: CompressedDump, Configuration, DumpStorage, FtpService, InvalidConfigurationError, PgDumpError, SqlDump, Utils

Constant Summary collapse

VERSION =
'0.3.1'.freeze

Instance Method Summary collapse

Methods included from Concurrency

#concurrently, included

Constructor Details

#initialize {|config| ... } ⇒ PgExport

Returns a new instance of PgExport.

Yields:

  • (config)


24
25
26
27
28
# File 'lib/pg_export.rb', line 24

def initialize
  @config = Configuration.new
  yield config if block_given?
  config.validate
end

Instance Method Details

#callObject



30
31
32
33
34
35
36
37
38
# File 'lib/pg_export.rb', line 30

def call
  concurrently do |job|
    job << create_dump
    job << initialize_dump_storage
  end
  dump_storage.upload(dump)
  dump_storage.remove_old(keep: config.keep_dumps)
  self
end